XMLSplitterConfigurationBeanBuilder { public static JsonNode buildBeanForInput(TypeDescriptor descriptor) throws JDOMException, IOException { Element element = XMLSplitterSerialisationHelper.typeDescriptorToExtensionXML(descriptor); return buildBeanForInput(element); }  static JsonNode buildBeanForInput(TypeDescriptor descriptor); static JsonNode buildBeanForOutput(TypeDescriptor descriptor); static JsonNode buildBeanForInput(Element element); static JsonNode buildBeanForOutput(Element element);  }
@Test public void testBuildBeanForInput() throws Exception { String xml = "<s:extensions xmlns:s=\"http: Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement(); JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element); assertNotNull("The bean should not be null",bean); assertEquals("There should be 1 input",1,bean.get("inputPorts").size()); assertEquals("There should be 1 output",1,bean.get("outputPorts").size()); assertEquals("The input should be named person","person",bean.get("inputPorts").get(0).get("name").textValue()); assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue()); assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue()); }
@Test public void testBuildBeanForInput2() throws Exception { String xml = "<s:extensions xmlns:s=\"http: Element element = new SAXBuilder().build(new StringReader(xml)).getRootElement(); JsonNode bean = XMLSplitterConfigurationBeanBuilder.buildBeanForInput(element); assertNotNull("The bean should not be null",bean); assertEquals("There should be 4 inputs",4,bean.get("inputPorts").size()); assertEquals("There should be 1 output",1,bean.get("outputPorts").size()); assertEquals("The first input should be named address","address",bean.get("inputPorts").get(0).get("name").textValue()); assertEquals("The output should be named output","output",bean.get("outputPorts").get(0).get("name").textValue()); assertEquals("The type xml definition should match",xml,bean.get("wrappedType").textValue()); }