[
https://issues.apache.org/jira/browse/NIFI-5974?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Matt Burgess updated NIFI-5974:
-------------------------------
Affects Version/s: (was: 1.8.0)
Status: Patch Available (was: Open)
> 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: 10m
> 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)