[ 
https://issues.apache.org/jira/browse/NIFI-5974?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16756182#comment-16756182
 ] 

ASF subversion and git services commented on NIFI-5974:
-------------------------------------------------------

Commit 8e777203a02c6e6d9772c9dec86966c9516d56fe in nifi's branch 
refs/heads/master from a.durov
[ https://gitbox.apache.org/repos/asf?p=nifi.git;h=8e77720 ]

NIFI-5974 fix: Fragment Attributes are populated in case no split has occured.
Unit test is implemented: testNoSplitterInString

NIFI-5974: Fixed Checkstyle violations

Signed-off-by: Matthew Burgess <[email protected]>

This closes #3275


> SplitContent: missing Fragment Attributes if the splitter wasn't found
> ----------------------------------------------------------------------
>
>                 Key: NIFI-5974
>                 URL: https://issues.apache.org/jira/browse/NIFI-5974
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>            Reporter: Alexey Durov
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> If there is no splitter in the input Flow File and nothing was changed the 
> Fragment Attributes are missing in the result. That breaks the MergeContent 
> processor as it doesn't know how many fragments are expected.
> For example if the splitter is "," and the targed content is "UVAT" there are 
> no {{fragment.count}}, {{fragment.identifier}}, {{fragment.index}}, 
> {{segment.original.filename}} attributes in the result.
> *Expected result*: "splits" flow file has mentioned attributes.
> Here is a "red" test:
> {code}
> @Test
> public void testNoSplitterInString() {
>       
>       String content = "UVAT";
>       
>       final TestRunner runner = TestRunners.newTestRunner(new SplitContent());
>       runner.setProperty(SplitContent.FORMAT, 
> SplitContent.UTF8_FORMAT.getValue());
>       runner.setProperty(SplitContent.BYTE_SEQUENCE, ",");
>       runner.setProperty(SplitContent.KEEP_SEQUENCE, "false");
>       runner.setProperty(SplitContent.BYTE_SEQUENCE_LOCATION, 
> SplitContent.TRAILING_POSITION.getValue());
>       runner.enqueue(content.getBytes());
>       runner.run();
>       runner.assertTransferCount(SplitContent.REL_SPLITS, 1);
>       MockFlowFile splitResult = 
> runner.getFlowFilesForRelationship(SplitContent.REL_SPLITS).get(0);
>       splitResult.assertAttributeExists(FRAGMENT_ID);
>       splitResult.assertAttributeExists(SEGMENT_ORIGINAL_FILENAME);
>       splitResult.assertAttributeEquals(FRAGMENT_COUNT, "1");
>       splitResult.assertAttributeEquals(FRAGMENT_INDEX, "1");
>       runner.assertTransferCount(SplitContent.REL_ORIGINAL, 1);
>       runner.assertQueueEmpty();
>       final List<MockFlowFile> splits = 
> runner.getFlowFilesForRelationship(SplitContent.REL_SPLITS);
>       splits.get(0).assertContentEquals(content);
> }
> {code}
> The fix is ready, pending PR



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to