NIFI-8074 Switched ReplaceText to use line by line evaluation as its default evaluation mode.

This closes #4711

Signed-off-by: Mike Thomsen <mthomsen@apache.org>
This commit is contained in:
Mike Thomsen 2020-12-06 08:37:34 -05:00
parent 1f8b4e4779
commit 8e4948322e
No known key found for this signature in database
GPG Key ID: 88511C3D4CAD246F
2 changed files with 4 additions and 1 deletions

View File

@ -172,7 +172,7 @@ public class ReplaceText extends AbstractProcessor {
.description("Run the 'Replacement Strategy' against each line separately (Line-by-Line) or buffer the entire file "
+ "into memory (Entire Text) and run against that.")
.allowableValues(LINE_BY_LINE, ENTIRE_TEXT)
.defaultValue(ENTIRE_TEXT)
.defaultValue(LINE_BY_LINE)
.required(true)
.build();

View File

@ -770,6 +770,7 @@ public class TestReplaceText {
runner.setProperty(ReplaceText.SEARCH_VALUE, "[123]");
runner.setProperty(ReplaceText.MAX_BUFFER_SIZE, "1 b");
runner.setProperty(ReplaceText.REPLACEMENT_VALUE, "${abc}");
runner.setProperty(ReplaceText.EVALUATION_MODE, ReplaceText.ENTIRE_TEXT);
final Map<String, String> attributes = new HashMap<>();
attributes.put("abc", "Good");
@ -823,6 +824,7 @@ public class TestReplaceText {
final TestRunner runner = getRunner();
runner.setProperty(ReplaceText.SEARCH_VALUE, "(?s)(^.*)");
runner.setProperty(ReplaceText.REPLACEMENT_VALUE, "attribute header\n\n${filename}\n\ndata header\n\n$1\n\nfooter");
runner.setProperty(ReplaceText.EVALUATION_MODE, ReplaceText.ENTIRE_TEXT);
final Map<String, String> attributes = new HashMap<>();
attributes.put("filename", "abc.txt");
@ -879,6 +881,7 @@ public class TestReplaceText {
// leave the default regex settings
final TestRunner runner = getRunner();
runner.setProperty(ReplaceText.REPLACEMENT_VALUE, defaultValue);
runner.setProperty(ReplaceText.EVALUATION_MODE, ReplaceText.ENTIRE_TEXT);
final Map<String, String> attributes = new HashMap<>();
runner.enqueue(("original-text-line-1" + System.lineSeparator() + "original-text-line-2").getBytes(StandardCharsets.UTF_8), attributes);