You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jmeter.apache.org by GitBox <gi...@apache.org> on 2021/12/09 23:54:31 UTC

[GitHub] [jmeter] polarnik opened a new pull request #679: Add variable support for Include Controller

polarnik opened a new pull request #679:
URL: https://github.com/apache/jmeter/pull/679


   ==============
   
   - Add variable support for includePath
   - Add tests for getIncludePathAsFunction()
   
   ## Description
   The IncludePath field has added support for variables.
   
   ## Motivation and Context
   I want to use files in Include Controller whose names are set in variables.
   
   For Example 1.
   I want to run the test with loading static resources and without loading static resources.
   Static resources - 200 links.
   If I use If Controller, then an optional block with static resources will be in the script, it will take up memory.
   If I use Include Controller with variable support, then optional block with 200 links may be change for block with 0 links. A block with 0 links will not take up memory.
   
   For Example 2.
   I work in a large team. We decided to change the Access Token update block in all scenarios. From the test_fragment_refresh_Access Token_v1.jms option to test_fragment_refresh_Access Token_v2.jmx. 10 scripts.
   
   Instead of 10 changes in the scripts. The function ${__property(text_fragment_refresh_access Token)} or ${__P(text_fragment_refresh_access Token)} will be used. And there will be one change in user.property.
   
   ## How Has This Been Tested?
   I write some tests.
   And test via gradle runGui.
   For troubleshooting: add debug loggings.
   
   ## Screenshots (if appropriate):
   Fail load:
   ![image](https://user-images.githubusercontent.com/7660287/145493443-e5f91667-3b31-41fc-9211-ca6b3b0cea5f.png)
   
   Ok load:
   ![image](https://user-images.githubusercontent.com/7660287/145493810-61884064-8ef7-459a-b80b-a67836cbbd1f.png)
   
   
   ## Types of changes
   - New feature (non-breaking change which adds functionality)
   
   ## Checklist:
   
   - [x] My code follows the [code style][style-guide] of this project.
   - [ ] I have updated the documentation accordingly.
   
   [style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines
   


-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] codecov-commenter commented on pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #679:
URL: https://github.com/apache/jmeter/pull/679#issuecomment-1001071148


   # [Codecov](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#679](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (be21f47) into [master](https://codecov.io/gh/apache/jmeter/commit/edc77273e9fc7d3ceb986252d6ac83ae79b30aaf?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (edc7727) will **increase** coverage by `0.00%`.
   > The diff coverage is `80.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/jmeter/pull/679/graphs/tree.svg?width=650&height=150&src=pr&token=6Q7CI1wFSh&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@            Coverage Diff            @@
   ##             master     #679   +/-   ##
   =========================================
     Coverage     55.57%   55.58%           
   - Complexity    10333    10335    +2     
   =========================================
     Files          1059     1059           
     Lines         65055    65065   +10     
     Branches       7403     7400    -3     
   =========================================
   + Hits          36156    36167   +11     
     Misses        26349    26349           
   + Partials       2550     2549    -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...a/org/apache/jmeter/control/IncludeController.java](https://codecov.io/gh/apache/jmeter/pull/679/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL2NvbXBvbmVudHMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2ptZXRlci9jb250cm9sL0luY2x1ZGVDb250cm9sbGVyLmphdmE=) | `59.78% <80.00%> (+3.37%)` | :arrow_up: |
   | [...n/java/org/apache/jmeter/reporters/Summariser.java](https://codecov.io/gh/apache/jmeter/pull/679/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL2NvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2ptZXRlci9yZXBvcnRlcnMvU3VtbWFyaXNlci5qYXZh) | `90.07% <0.00%> (-0.77%)` | :arrow_down: |
   | [...he/jmeter/threads/openmodel/gui/TargetRateChart.kt](https://codecov.io/gh/apache/jmeter/pull/679/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL2NvcmUvc3JjL21haW4va290bGluL29yZy9hcGFjaGUvam1ldGVyL3RocmVhZHMvb3Blbm1vZGVsL2d1aS9UYXJnZXRSYXRlQ2hhcnQua3Q=) | `6.25% <0.00%> (+0.36%)` | :arrow_up: |
   | [...jmeter/protocol/http/control/HttpMirrorServer.java](https://codecov.io/gh/apache/jmeter/pull/679/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3JjL3Byb3RvY29sL2h0dHAvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2ptZXRlci9wcm90b2NvbC9odHRwL2NvbnRyb2wvSHR0cE1pcnJvclNlcnZlci5qYXZh) | `42.42% <0.00%> (+1.01%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [edc7727...be21f47](https://codecov.io/gh/apache/jmeter/pull/679?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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 `getIncludePath()` 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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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 `getIncludePath()` 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 `include Path.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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] vlsi commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
vlsi commented on a change in pull request #679:
URL: https://github.com/apache/jmeter/pull/679#discussion_r775268890



##########
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:
       AFAIK `setRunningVersions(tue)` should be called just before script execution (like it is called for other elements)




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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 insdead of simple `this.getPropertyAsString(INCLUDE_PATH)` for valiable an functions support without change of value `includePath`




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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 `getIncludePath()` 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`




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] vlsi commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
vlsi commented on a change in pull request #679:
URL: https://github.com/apache/jmeter/pull/679#discussion_r771344954



##########
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:
       I think this is the wrong approach to attack the problem. It looks like `includePath.setRunningVersion(true)`.




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
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 `getIncludePath As Function()` 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`




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
polarnik commented on a change in pull request #679:
URL: https://github.com/apache/jmeter/pull/679#discussion_r775269209



##########
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:
       Ok. I try tested this




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [jmeter] polarnik commented on a change in pull request #679: Add variable support for Include Controller

Posted by GitBox <gi...@apache.org>.
polarnik commented on a change in pull request #679:
URL: https://github.com/apache/jmeter/pull/679#discussion_r775267335



##########
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:
       if apply `includePath.setRunningVersion(true)`
   and set includePath like `${__P(somePropName, 'defaultValue')}`
   and open JMX File in GUI Mode
   
   then includePath view like value of `somePropName` or `'defaultValue'`, but not view as `${__P(somePropName, 'defaultValue')}`




-- 
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: dev-unsubscribe@jmeter.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org