polarnik commented on a change in pull request #679:
URL: https://github.com/apache/jmeter/pull/679#discussion_r775267682



##########
File path: 
src/components/src/main/java/org/apache/jmeter/control/IncludeController.java
##########
@@ -92,6 +94,32 @@ public String getIncludePath() {
         return this.getPropertyAsString(INCLUDE_PATH);
     }
 
+    /**
+     * return the JMX file path with function support.
+     * @return the JMX file path with function support
+     */
+    public String getIncludePathAsFunction()
+    {
+        String jmxfile = this.getPropertyAsString(INCLUDE_PATH);
+        CompoundVariable masterFunction = new CompoundVariable();
+        try{
+            log.debug("Trying to evaluate 'Include Path' as an expression: 
{}", jmxfile);
+            masterFunction.setParameters(jmxfile);
+            if(masterFunction.hasFunction()) {
+                String jmxfileCompile = masterFunction.getFunction().execute();
+                log.debug("The value of 'Include Path' is computed as: {}", 
jmxfileCompile);
+                return jmxfileCompile;
+            }
+        } catch (InvalidVariableException e)
+        {
+            log.warn("Invalid variable in 'Include Path' {}. See log for 
details", jmxfile);
+            log.warn("Invalid variable in 'Include Path':", e);
+        }
+
+        log.debug("The value of 'Include Path' is simple string: {}", jmxfile);
+        return jmxfile;
+    }

Review comment:
       Function `getIncludePathAsFunction()` did not change value of 
`includePath`. Function `getIncludePathAsFunction()` used instead of simple 
`this.getPropertyAsString(INCLUDE_PATH)` for variables and functions support 
without change of value `includePath`.
   
   Script developer may open JMX file in GUI mode, press Save button, and JMX 
file was saved without changes.
   
   If used `includePath.setRunningVersion(true)`, then after open JMX script in 
GUI mode and press Save button - original expression will be replaced with 
expression value.




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


Reply via email to