GitHub user alopresto opened a pull request:
https://github.com/apache/nifi/pull/474
NIFI-1919 Add replaceFirst method to expression language
I will open an additional Jira for 1.0 to consider renaming the `replace`
method to `replaceAllLiteral` or something similar, and add logic to
`StandardFlowSynchronizer` to perform method replacement if this occurs.
I think there is an opportunity to refactor and consolidate the
`*Evaluator` classes -- `ReplaceEvaluator`, `ReplaceFirstEvaluator`, and
`ReplaceAllEvaluator` are identical save for the delegate `String` method that
is invoked internally.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/alopresto/nifi NIFI-1919
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/nifi/pull/474.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #474
----
commit 3431fd47bfd5c0f67d3e8ccfb00af7bebdb5a97e
Author: Andy LoPresto <[email protected]>
Date: 2016-05-25T02:05:34Z
NIFI-1919 Added Groovy unit test to demonstrate issue.
Added DelegatingMetaClass code to record it (test not complete).
commit 0780fed41b00607fd17b0ff88f9c5d5d49177694
Author: Andy LoPresto <[email protected]>
Date: 2016-05-25T02:12:19Z
NIFI-1919 Added working unit test to illustrate fix.
commit f34e2836b1acfb2abcb4a6a98fc13374ba498388
Author: Andy LoPresto <[email protected]>
Date: 2016-05-25T02:28:37Z
NIFI-1918 Ignored failing test because timing is not deterministic and
should not be used in unit test.
Signed-off-by: Matt Burgess <[email protected]>
This closes #465
commit bd42a8b85c9fdc6ba2d917b718e558885bdc1282
Author: Andy LoPresto <[email protected]>
Date: 2016-05-25T17:37:18Z
NIFI-1919 Changed ReplaceEvaluator to use String#replaceFirst which
interprets regex instead of compiling as literal.
Demonstrative unit test now passes but two existing unit tests fail. I am
not sure these tests are correct.
commit 15523f826d22aa38fdf40e294044236c76bcd5f3
Author: Andy LoPresto <[email protected]>
Date: 2016-05-25T17:40:07Z
NIFI-1919 Ignored demonstrative test for replaceAll as it behaves as
expected.
commit 7cfd960e1bdac8c04db6f2aee3f57baed3dc077a
Author: Andy LoPresto <[email protected]>
Date: 2016-05-27T02:37:28Z
NIFI-1919 Added replaceFirst to AttributeExpression lexer and parser
grammar definitions.
commit ba47ef3f916090646ce40542a406289e2cf757a7
Author: Andy LoPresto <[email protected]>
Date: 2016-05-27T02:38:54Z
NIFI-1919 Reverted changes to ReplaceEvaluator.
Added ReplaceFirstEvaluator.
Added replace first logic to Query buildFunctionEvaluator.
Added unit tests.
commit 8e832be3e29e2291e7adcf058291bc73ba78e94d
Author: Andy LoPresto <[email protected]>
Date: 2016-05-27T22:50:05Z
NIFI-1919 Updated expression language guide.
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---