markap14 commented on code in PR #5896: URL: https://github.com/apache/nifi/pull/5896#discussion_r842070382
########## nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLReader.java: ########## @@ -157,4 +190,26 @@ public void testContentField() throws IOException, InitializationException { assertEquals("MapRecord[{ID=P4, NAME=MapRecord[{CONTENT=Elenora Scrivens, ATTR=attr content, INNER=inner content}], AGE=16}]", records.get(3)); assertEquals("MapRecord[{ID=P5, NAME=MapRecord[{INNER=inner content}]}]", records.get(4)); } + + @Test + public void testInferSchema() throws InitializationException, IOException { + // GIVEN + String expectedContent = "MapRecord[{software=MapRecord[{" + CONTENT_NAME + "=Apache NiFi, favorite=true}], num=123, name=John Doe}]"; + + Map<PropertyDescriptor, String> xmlReaderProperties = new HashMap<>(); + xmlReaderProperties.put(SchemaAccessUtils.SCHEMA_ACCESS_STRATEGY, SchemaInferenceUtil.INFER_SCHEMA.getValue()); + xmlReaderProperties.put(XMLReader.RECORD_FORMAT, XMLReader.RECORD_SINGLE.getValue()); + xmlReaderProperties.put(XMLReader.CONTENT_FIELD_NAME, CONTENT_NAME); + TestRunner runner = setup(xmlReaderProperties); + + // WHEN + InputStream is = new FileInputStream("src/test/resources/xml/person_record.xml"); Review Comment: The InputStream needs to be in a try-with-resources to ensure that it gets closed -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org