mirror of https://github.com/apache/nifi.git
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:
parent
1f8b4e4779
commit
8e4948322e
|
@ -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();
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue