pgyori commented on code in PR #5964:
URL: https://github.com/apache/nifi/pull/5964#discussion_r856362563
##########
nifi-nar-bundles/nifi-standard-services/nifi-record-serialization-services-bundle/nifi-record-serialization-services/src/test/java/org/apache/nifi/xml/TestXMLReader.java:
##########
@@ -279,4 +279,23 @@ public void
testInferSchemaContentFieldNameSetSubElementExistsNoNameClash() thro
String actualContent = out.getContent();
assertEquals(expectedContent, actualContent);
}
+
+ @Test
+ public void testInferSchemaIgnoreAttributes() throws
InitializationException, IOException {
+ String expectedContent = "MapRecord[{software=Apache NiFi, 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.PARSE_XML_ATTRIBUTES, "false");
+ TestRunner runner = setup(xmlReaderProperties);
+
+ InputStream is = new
FileInputStream("src/test/resources/xml/person_record.xml");
+ runner.enqueue(is);
+ runner.run();
+
+ MockFlowFile out =
runner.getFlowFilesForRelationship(TestXMLReaderProcessor.SUCCESS).get(0);
+ String actualContent = out.getContent();
+ assertEquals(expectedContent, actualContent);
Review Comment:
Yes. I don't know why it wasn't used in the first place. Thanks.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]