test_class.file: taverna-wsdl-generic/src/test/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitterTest.java
test_class.identifier: XMLOutputSplitterTest
test_class.superclass: extends WSDLTestHelper
test_case.body: @Test
  	public void testRPCComplexWithInternalList() throws Exception {
              
          WSDLParser parser = new WSDLParser(WSDLTestHelper.wsdlResourcePath("menagerie-complex-rpc.wsdl"));
  		TypeDescriptor descriptor = parser.getOperationOutputParameters("getComplexWithInternalList").get(0);
          XMLOutputSplitter splitter = new XMLOutputSplitter(descriptor, new String [] {"length","innerArray","innerList"}, new String [] {"text/plain","l('text/plain')","l('text/plain')"}, new String[] {"input"});
          String inputXML=getResourceAsString("getComplexWithInternalListResponse.xml");
          Map<String,String> inputMap = new HashMap<String,String>();
          inputMap.put("input", inputXML);
          Map<String,Object> outputMap = splitter.execute(inputMap);
          assertNotNull(outputMap.get("length"));
          assertNotNull(outputMap.get("innerList"));
          assertNotNull(outputMap.get("innerArray"));
  
          assertEquals("4",outputMap.get("length"));
  
          List<String> array = ( List<String> )outputMap.get("innerArray");
  		assertEquals(4,array.size());
  		assertEquals("String A",array.get(0));
  		assertEquals("String B",array.get(1));
  		assertEquals("String C",array.get(2));
  		assertEquals("String D",array.get(3));
  
          array = ( List<String> )outputMap.get("innerList");
  		assertEquals(4,array.size());
  		assertEquals("String A",array.get(0));
  		assertEquals("String B",array.get(1));
  		assertEquals("String C",array.get(2));
  		assertEquals("String D",array.get(3));
      }
test_case.class_method_signature: XMLOutputSplitterTest.testRPCComplexWithInternalList()
test_case.full_signature: @Test public void testRPCComplexWithInternalList()
test_case.identifier: testRPCComplexWithInternalList
test_case.invocations: wsdlResourcePath get getOperationOutputParameters getResourceAsString put execute assertNotNull get assertNotNull get assertNotNull get assertEquals get get assertEquals size assertEquals get assertEquals get assertEquals get assertEquals get get assertEquals size assertEquals get assertEquals get assertEquals get assertEquals get
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testRPCComplexWithInternalList()
focal_class.declarator: typeDescriptor
focal_class.modifier: private
focal_class.original_string: private TypeDescriptor typeDescriptor;
focal_class.type: TypeDescriptor
focal_class.var_name: typeDescriptor
focal_class.declarator: outputNames
focal_class.modifier: private
focal_class.original_string: private String[] outputNames;
focal_class.type: String[]
focal_class.var_name: outputNames
focal_class.declarator: inputNames
focal_class.modifier: private
focal_class.original_string: private String[] inputNames;
focal_class.type: String[]
focal_class.var_name: inputNames
focal_class.declarator: outputTypes
focal_class.modifier: private
focal_class.original_string: private String[] outputTypes;
focal_class.type: String[]
focal_class.var_name: outputTypes
focal_class.file: taverna-wsdl-generic/src/main/java/org/apache/taverna/wsdl/xmlsplitter/XMLOutputSplitter.java
focal_class.identifier: XMLOutputSplitter
focal_class.class_method_signature: XMLOutputSplitter.XMLOutputSplitter(TypeDescriptor typeDescriptor,
  			String[] outputNames, String[] outputTypes,String[] inputNames)
focal_class.full_signature: public  XMLOutputSplitter(TypeDescriptor typeDescriptor,
  			String[] outputNames, String[] outputTypes,String[] inputNames)
focal_class.identifier: XMLOutputSplitter
focal_class.modifiers: public
focal_class.parameters: (TypeDescriptor typeDescriptor,
  			String[] outputNames, String[] outputTypes,String[] inputNames)
focal_class.signature:  XMLOutputSplitter(TypeDescriptor typeDescriptor,
  			String[] outputNames, String[] outputTypes,String[] inputNames)
focal_class.class_method_signature: XMLOutputSplitter.execute(Map<String, String> inputMap)
focal_class.full_signature: @SuppressWarnings("unchecked") public Map<String, Object> execute(Map<String, String> inputMap)
focal_class.identifier: execute
focal_class.modifiers: @SuppressWarnings("unchecked") public
focal_class.parameters: (Map<String, String> inputMap)
focal_class.return: Map<String, Object>
focal_class.signature: Map<String, Object> execute(Map<String, String> inputMap)
focal_class.class_method_signature: XMLOutputSplitter.executeForArrayType(Map<String, Object> result,
  			List<Element> children)
focal_class.full_signature: private void executeForArrayType(Map<String, Object> result,
  			List<Element> children)
focal_class.identifier: executeForArrayType
focal_class.modifiers: private
focal_class.parameters: (Map<String, Object> result,
  			List<Element> children)
focal_class.return: void
focal_class.signature: void executeForArrayType(Map<String, Object> result,
  			List<Element> children)
focal_class.class_method_signature: XMLOutputSplitter.executeForComplexType(Map<String, Object> result,
  			List<String> outputNameList, List<Element> children, List<Attribute> list)
focal_class.full_signature: @SuppressWarnings({ "unchecked" }) private void executeForComplexType(Map<String, Object> result,
  			List<String> outputNameList, List<Element> children, List<Attribute> list)
focal_class.identifier: executeForComplexType
focal_class.modifiers: @SuppressWarnings({ "unchecked" }) private
focal_class.parameters: (Map<String, Object> result,
  			List<String> outputNameList, List<Element> children, List<Attribute> list)
focal_class.return: void
focal_class.signature: void executeForComplexType(Map<String, Object> result,
  			List<String> outputNameList, List<Element> children, List<Attribute> list)
focal_class.class_method_signature: XMLOutputSplitter.extractDataListFromChildList(List<Element> children,
  			boolean isXMLContent)
focal_class.full_signature: private List<String> extractDataListFromChildList(List<Element> children,
  			boolean isXMLContent)
focal_class.identifier: extractDataListFromChildList
focal_class.modifiers: private
focal_class.parameters: (List<Element> children,
  			boolean isXMLContent)
focal_class.return: List<String>
focal_class.signature: List<String> extractDataListFromChildList(List<Element> children,
  			boolean isXMLContent)
focal_class.class_method_signature: XMLOutputSplitter.extractBaseTypeArrayFromChildren(List<Element> children)
focal_class.full_signature: private List<String> extractBaseTypeArrayFromChildren(List<Element> children)
focal_class.identifier: extractBaseTypeArrayFromChildren
focal_class.modifiers: private
focal_class.parameters: (List<Element> children)
focal_class.return: List<String>
focal_class.signature: List<String> extractBaseTypeArrayFromChildren(List<Element> children)
focal_method.body: @SuppressWarnings("unchecked")
  	public Map<String, Object> execute(Map<String, String> inputMap)
  			throws XMLSplitterExecutionException {
  
  		Map<String, Object> result = new HashMap<String, Object>();
  		List<String> outputNameList = Arrays.asList(outputNames);
  
  		String xml = inputMap.get(inputNames[0]);
  		try {
  			Document doc = new SAXBuilder().build(new StringReader(xml));
  			List<Element> children = doc.getRootElement().getChildren();
  			if (typeDescriptor instanceof ArrayTypeDescriptor) {
  				if (outputNames.length > 1)
  					throw new XMLSplitterExecutionException(
  							"Unexpected, multiple output names for ArrayType");
  				executeForArrayType(result, children);
  			} else {
  				executeForComplexType(result, outputNameList, children, doc.getRootElement().getAttributes());
  			}
  
  			// populate missing outputs with empty strings for basic types,
  			// empty elements for complex/array types.
  			for (int i = 0; i < outputNames.length; i++) {
  				if (result.get(outputNames[i]) == null) {
  					if (outputTypes[i].equals("'text/xml'")) {
  						result
  								.put(outputNames[i], "<" + outputNames[i]
  										+ " />");
  					} else if (outputTypes[i].startsWith("l('")) {
  						result.put(outputNames[i], new ArrayList<Object>());
  					} else {
  						result.put(outputNames[i], "");
  					}
  
  				}
  			}
  		} catch (JDOMException e) {
  			throw new XMLSplitterExecutionException("Unable to parse XML: " + xml, e);
  		} catch (IOException e) {
  			throw new XMLSplitterExecutionException("IOException parsing XML: " + xml,
  					e);
  		}
  
  		return result;
  	}
focal_method.class_method_signature: XMLOutputSplitter.execute(Map<String, String> inputMap)
focal_method.full_signature: @SuppressWarnings("unchecked") public Map<String, Object> execute(Map<String, String> inputMap)
focal_method.identifier: execute
focal_method.invocations: asList get build getChildren getRootElement executeForArrayType executeForComplexType getAttributes getRootElement get equals put startsWith put put
focal_method.modifiers: @SuppressWarnings("unchecked") public
focal_method.parameters: (Map<String, String> inputMap)
focal_method.return: Map<String, Object>
focal_method.signature: Map<String, Object> execute(Map<String, String> inputMap)