[
https://issues.apache.org/jira/browse/NIFI-738?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14604815#comment-14604815
]
ASF GitHub Bot commented on NIFI-738:
-------------------------------------
Github user joewitt commented on the pull request:
https://github.com/apache/incubator-nifi/pull/69#issuecomment-116304173
Ryan
Please add the below unit test to TestCVSToAvroProcessor. It will fail and
explains why nicely. This issue is present in AvroToCSV as well I believe.
Only other thing I noticed was that you did not cap the number of
errors/reasons you'll store. I just bring this up as a 'be sure this is fine'
thing. It isn't clear if this is important in a practical sense.
```java
@Test
public void testBasicConversionNoErrors() throws IOException {
TestRunner runner =
TestRunners.newTestRunner(ConvertCSVToAvro.class);
runner.assertNotValid();
runner.setProperty(ConvertCSVToAvro.SCHEMA, SCHEMA.toString());
runner.assertValid();
runner.enqueue(streamFor("1,green\n2,blue,\n3,grey,12.95"));
runner.run();
long converted = runner.getCounterValue("Converted records");
long errors = runner.getCounterValue("Conversion errors");
Assert.assertEquals("Should convert 2 rows", 2, converted);
Assert.assertEquals("Should reject 0 row", 0, errors);
runner.assertTransferCount("success", 1);
runner.assertTransferCount("failure", 0);
runner.assertTransferCount("incompatible", 0);
}
```
> Do not write conversion error messages to flow file content
> -----------------------------------------------------------
>
> Key: NIFI-738
> URL: https://issues.apache.org/jira/browse/NIFI-738
> Project: Apache NiFi
> Issue Type: Bug
> Components: Extensions
> Affects Versions: 0.1.0
> Reporter: Ryan Blue
> Assignee: Ryan Blue
> Fix For: 0.2.0
>
>
> NIFI-551 extended the error handling provided by the ConvertJSONToAvro
> processor, but wrote error messages as the content of a file sent on the
> failure relationship. I think the right thing to do is to output the bad
> records as the file content and put the error messages in the outgoing
> attributes.
> NIFI-551 wasn't included in 0.1.0, so changing this behavior is safe.
> Consequently, I'd like to get this fix into 0.2.0.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)