exceptionfactory commented on code in PR #11059:
URL: https://github.com/apache/nifi/pull/11059#discussion_r3012248075
##########
nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/test/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScriptTest.java:
##########
@@ -566,6 +567,31 @@ public void test_sensitive_dynamic_property() {
runner.run();
}
+ @Test void invalidExpressionLanguageInDynamicProperty() {
Review Comment:
The annotation should be declared above the method, not on the same line.
##########
nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/test/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScriptTest.java:
##########
@@ -566,6 +567,31 @@ public void test_sensitive_dynamic_property() {
runner.run();
}
+ @Test void invalidExpressionLanguageInDynamicProperty() {
+ runner.setProperty("myProperty", "${myparam:isempty()}");
+ runner.setProperty(ExecuteGroovyScript.SCRIPT_BODY, "assert true ==
true");
+ runner.setProperty(ExecuteGroovyScript.FAIL_STRATEGY, "transfer to
failure");
Review Comment:
The `transfer to failure` string should be declared statically in this test
class and reused.
##########
nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/test/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScriptTest.java:
##########
@@ -566,6 +567,31 @@ public void test_sensitive_dynamic_property() {
runner.run();
}
+ @Test void invalidExpressionLanguageInDynamicProperty() {
+ runner.setProperty("myProperty", "${myparam:isempty()}");
+ runner.setProperty(ExecuteGroovyScript.SCRIPT_BODY, "assert true ==
true");
+ runner.setProperty(ExecuteGroovyScript.FAIL_STRATEGY, "transfer to
failure");
+ runner.assertNotValid();
+ }
+
+ @Test void
validExpressionLanguageInDynamicPropertyWithVariableValueWhichCannotBeUsedWithELExpression()
{
Review Comment:
Reformatting needed for the annotation.
##########
nifi-extension-bundles/nifi-groovyx-bundle/nifi-groovyx-processors/src/main/java/org/apache/nifi/processors/groovyx/ExecuteGroovyScript.java:
##########
@@ -448,6 +449,12 @@ public void onTrigger(final ProcessContext context, final
ProcessSession process
//create wrapped session to control list of newly created and files
got from this session.
//so transfer original input to failure will be possible
GroovyProcessSessionWrap session = new
GroovyProcessSessionWrap(processSession, toFailureOnError);
+ if (toFailureOnError) {
+ FlowFile flowFile = session.get();
+ if (flowFile == null) {
+ return;
+ }
+ }
Review Comment:
The reason for this behavior is not clear, a comment above would be helpful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]