markap14 commented on a change in pull request #4746:
URL: https://github.com/apache/nifi/pull/4746#discussion_r561166527



##########
File path: 
nifi-commons/nifi-expression-language/src/test/java/org/apache/nifi/attribute/expression/language/TestStandardPreparedQuery.java
##########
@@ -309,6 +309,24 @@ public void testVariableImpacted() {
         
assertTrue(Query.prepare("${anyMatchingAttribute('a.*'):equals('hello')}").getVariableImpact().isImpacted("attr"));
     }
 
+    @Test
+    public void testIsExpressionLanguagePresent() {
+        assertFalse(Query.prepare("value").isExpressionLanguagePresent());
+        assertFalse(Query.prepare("").isExpressionLanguagePresent());
+
+        assertTrue(Query.prepare("${variable}").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("${hostname()}").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("${hostname():equals('localhost')}").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("prefix-${hostname()}").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("${hostname()}-suffix").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("${variable1}${hostname()}${variable2}").isExpressionLanguagePresent());
+        
assertTrue(Query.prepare("${${variable}}").isExpressionLanguagePresent());
+
+        assertFalse(Query.prepare("${}").isExpressionLanguagePresent());
+
+        assertTrue(Query.prepare("#{param}").isExpressionLanguagePresent());

Review comment:
       Well, that's interesting. The user guide says:
   ```
   Value - The value that will be used when the Parameter is referenced. 
Parameter values do not support Expression Language or embedded parameter 
references.
   ```
   
   Parameters are not supposed to be able to make use of EL. But I just tried 
it with UpdateAttribute, and interestingly it did evaluate the reference. I 
think that is actually a bug, though. So I would tend to say that we should 
return `false` since Parameters are not supposed to support EL.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to