Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
Description
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:
@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); }
The fix is ready, pending PR
Attachments
Issue Links
- links to