Re: Place holder for function execution / Variables evaluation

2018-11-11 Thread Andrey Pokhilko
Hi,

There's already a plugin for that:
https://jmeter-plugins.org/wiki/SetVariablesAction/

It is exactly a sampler that is used to evaluate functions/variables.

--

Andrey Pokhilko

11.11.2018 20:53, Philippe Mouawad пишет:
> Hello,
> Frequently when using JMeter functions, users don't really know for certain
> use cases where to put the function, here are few examples:
>
>- Any function which output will not be used directly by sample
>parameters
>- Such type of functions:
>   - https://jmeter-plugins.org/wiki/InterThreadCommunication/
>- you want to create a variable from the output of a function and update
>it on each iteration:
>   - User Defined Variable is not an option as evaluation occurs on
>   start of test
>   - User Parameters being a preprocessor, it would be evaluated on each
>   call, so you need to nest it inside a Flow Control Action, not very
>   intuitive right ?
>
> I also remember when I started using JMeter that I found this part
> counter-intuitive.
>
> I think it would be nice to have a solution for this, that would evaluate
> the variables/functions exactly at the place where the call is present and
> without generating any SampleResult.
>
> We could implement this:
>
>- as an enhancement to Flow Control Action
>- as a new Sampler
>
> What's your thoughts on this ?
>
> Regards
>


[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9

2018-11-11 Thread FSchumacher
Github user FSchumacher commented on the issue:

https://github.com/apache/jmeter/pull/431
  
Well, I don't know, if we can generalize it, but it is surely the first 
hits, only. There will be more, when I have slept a bit.


---


[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9

2018-11-11 Thread codecov-io
Github user codecov-io commented on the issue:

https://github.com/apache/jmeter/pull/431
  
# [Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=h1) 
Report
> Merging 
[#431](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=desc) into 
[trunk](https://codecov.io/gh/apache/jmeter/commit/95361b101ad7fdfc5073e12ad667b82c85c2d7f5?src=pr=desc)
 will **increase** coverage by `<.01%`.
> The diff coverage is `4.16%`.

[![Impacted file tree 
graph](https://codecov.io/gh/apache/jmeter/pull/431/graphs/tree.svg?width=650=6Q7CI1wFSh=150=pr)](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=tree)

```diff
@@ Coverage Diff @@
##  trunk#431  +/-   ##
===
+ Coverage 58.59%   58.6%   +<.01% 
- Complexity10633   10635   +2 
===
  Files  11961196  
  Lines 76040   76039   -1 
  Branches   73577356   -1 
===
+ Hits  44558   44564   +6 
+ Misses28974   28969   -5 
+ Partials   25082506   -2
```


| [Impacted 
Files](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=tree) | Coverage 
Δ | Complexity Δ | |
|---|---|---|---|
| 
[...ore/org/apache/jmeter/gui/action/ActionRouter.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZ3VpL2FjdGlvbi9BY3Rpb25Sb3V0ZXIuamF2YQ==)
 | `6.61% <0%> (ø)` | `3 <0> (ø)` | :arrow_down: |
| 
[...jmeter/gui/action/AddThinkTimeBetweenEachStep.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZ3VpL2FjdGlvbi9BZGRUaGlua1RpbWVCZXR3ZWVuRWFjaFN0ZXAuamF2YQ==)
 | `0% <0%> (ø)` | `0 <0> (ø)` | :arrow_down: |
| 
[...jmeter/protocol/http/sampler/AccessLogSampler.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-c3JjL3Byb3RvY29sL2h0dHAvb3JnL2FwYWNoZS9qbWV0ZXIvcHJvdG9jb2wvaHR0cC9zYW1wbGVyL0FjY2Vzc0xvZ1NhbXBsZXIuamF2YQ==)
 | `7.69% <0%> (+0.07%)` | `3 <0> (ø)` | :arrow_down: |
| 
[test/src/org/apache/jorphan/test/AllTests.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-dGVzdC9zcmMvb3JnL2FwYWNoZS9qb3JwaGFuL3Rlc3QvQWxsVGVzdHMuamF2YQ==)
 | `81.25% <50%> (ø)` | `17 <0> (ø)` | :arrow_down: |
| 
[...re/org/apache/jmeter/engine/DistributedRunner.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-c3JjL2NvcmUvb3JnL2FwYWNoZS9qbWV0ZXIvZW5naW5lL0Rpc3RyaWJ1dGVkUnVubmVyLmphdmE=)
 | `85.71% <0%> (+3.36%)` | `32% <0%> (+1%)` | :arrow_up: |
| 
[...s/org/apache/jmeter/timers/PoissonRandomTimer.java](https://codecov.io/gh/apache/jmeter/pull/431/diff?src=pr=tree#diff-c3JjL2NvbXBvbmVudHMvb3JnL2FwYWNoZS9qbWV0ZXIvdGltZXJzL1BvaXNzb25SYW5kb21UaW1lci5qYXZh)
 | `78.37% <0%> (+5.4%)` | `10% <0%> (+1%)` | :arrow_up: |

--

[Continue to review full report at 
Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=continue).
> **Legend** - [Click here to learn 
more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute  (impact)`, `ø = not affected`, `? = missing 
data`
> Powered by 
[Codecov](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=footer). Last 
update 
[95361b1...b36e220](https://codecov.io/gh/apache/jmeter/pull/431?src=pr=lastupdated).
 Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).



---


[GitHub] jmeter issue #431: Class#newInstance deprecation with Java 9

2018-11-11 Thread pmouawad
Github user pmouawad commented on the issue:

https://github.com/apache/jmeter/pull/431
  
Hello Felix,
I guess this is a first step before generalization ?
As I see other places in code where newInstance() is used.

Regards



---


[GitHub] jmeter pull request #431: Class#newInstance deprecation with Java 9

2018-11-11 Thread FSchumacher
GitHub user FSchumacher opened a pull request:

https://github.com/apache/jmeter/pull/431

Class#newInstance deprecation with Java 9

## Description
Change invocation of Class#newInstance to Class#getConstructor#newInstance
And do some cleanup using StringUtils.isNotBlank

## Motivation and Context
Java 9 deprecates Class#newInstance, so this will get rid of the 
deprecation warnings

## How Has This Been Tested?
ran tests

## Screenshots (if appropriate):

## Types of changes

- Bug fix (non-breaking change which fixes an issue)

## Checklist:


- [x] My code follows the [code style][style-guide] of this project.

[style-guide]: https://wiki.apache.org/jmeter/CodeStyleGuidelines


You can merge this pull request into a Git repository by running:

$ git pull https://github.com/FSchumacher/jmeter newinstance-deprecation

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/jmeter/pull/431.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 #431


commit 3d8aa9c075770a669c9e8eb441e2d30d211b8fa9
Author: Felix Schumacher 
Date:   2018-11-11T21:16:06Z

Class#newInstance will be deprecated with Java 9

commit 224c7f41ff0c282baef55e6c5658a543aa4ee308
Author: Felix Schumacher 
Date:   2018-11-11T21:18:22Z

Get rid of deprecation warning of Class#newInstance

commit 9807e46ecc40bbb655fc847f429467bc3657d366
Author: Felix Schumacher 
Date:   2018-11-11T21:23:16Z

Get rid of deprecation warning for Class#newInstance

commit b36e2202d48b427d1dca7ecf62ccc23f9ae24f48
Author: Felix Schumacher 
Date:   2018-11-11T21:27:22Z

Get rid of deprecation warnings for Class#newInstance




---


Place holder for function execution / Variables evaluation

2018-11-11 Thread Philippe Mouawad
Hello,
Frequently when using JMeter functions, users don't really know for certain
use cases where to put the function, here are few examples:

   - Any function which output will not be used directly by sample
   parameters
   - Such type of functions:
  - https://jmeter-plugins.org/wiki/InterThreadCommunication/
   - you want to create a variable from the output of a function and update
   it on each iteration:
  - User Defined Variable is not an option as evaluation occurs on
  start of test
  - User Parameters being a preprocessor, it would be evaluated on each
  call, so you need to nest it inside a Flow Control Action, not very
  intuitive right ?

I also remember when I started using JMeter that I found this part
counter-intuitive.

I think it would be nice to have a solution for this, that would evaluate
the variables/functions exactly at the place where the call is present and
without generating any SampleResult.

We could implement this:

   - as an enhancement to Flow Control Action
   - as a new Sampler

What's your thoughts on this ?

Regards


Re: svn commit: r1846297 - in /jmeter/trunk: src/core/org/apache/jmeter/testelement/property/ObjectProperty.java xdocs/changes.xml

2018-11-11 Thread Felix Schumacher



Am 11.11.18 um 11:38 schrieb Philippe Mouawad:

Hello Felix,
my code would return null currently for null value
Objects.toString(vaoue) would return "null"

Am I missing something ?


No, I misread the javdoc.

Objects.toString(value, null) should do the trick, though.

Regards,

 Felix



Thanks

On Sat, Nov 10, 2018 at 1:06 PM Felix Schumacher <
felix.schumac...@internetallee.de> wrote:


Am 10.11.18 um 12:21 schrieb pmoua...@apache.org:

Author: pmouawad
Date: Sat Nov 10 11:21:56 2018
New Revision: 1846297

URL: http://svn.apache.org/viewvc?rev=1846297=rev
Log:
Bug 62900 - ObjectProperty#getStringValue() can throw

NullPointerException

Bugzilla Id: 62900

Modified:


jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java

  jmeter/trunk/xdocs/changes.xml

Modified:

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java

URL:

http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java?rev=1846297=1846296=1846297=diff
==

---

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
(original)

+++

jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
Sat Nov 10 11:21:56 2018

@@ -101,7 +101,11 @@ public class ObjectProperty extends Abst
*/
   @Override
   public String getStringValue() {
-return value.toString();
+if(value != null) {
+return value.toString();
+} else {
+return null;
+}

This could be shortened to Objects.toString(value) ;)

Felix


   }

   /**

Modified: jmeter/trunk/xdocs/changes.xml
URL:

http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1846297=1846296=1846297=diff
==

--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov 10 11:21:56 2018
@@ -197,6 +197,7 @@ of previous time slot as a base. Startin
   62795JMeter master sometimes ends distributed test

even though some of the slaves have not finished

   62336396Some shortcuts are not working

correctly on windows. Contributed by Michael Pavlov (michael.paulau at
gmail.com)

   62889Format JSON Arrays when displayed with JSON

Path Tester.

+62900ObjectProperty#getStringValue() can throw

NullPointerException

   








Re: svn commit: r1846297 - in /jmeter/trunk: src/core/org/apache/jmeter/testelement/property/ObjectProperty.java xdocs/changes.xml

2018-11-11 Thread Philippe Mouawad
Hello Felix,
my code would return null currently for null value
Objects.toString(vaoue) would return "null"

Am I missing something ?
Thanks

On Sat, Nov 10, 2018 at 1:06 PM Felix Schumacher <
felix.schumac...@internetallee.de> wrote:

>
> Am 10.11.18 um 12:21 schrieb pmoua...@apache.org:
> > Author: pmouawad
> > Date: Sat Nov 10 11:21:56 2018
> > New Revision: 1846297
> >
> > URL: http://svn.apache.org/viewvc?rev=1846297=rev
> > Log:
> > Bug 62900 - ObjectProperty#getStringValue() can throw
> NullPointerException
> > Bugzilla Id: 62900
> >
> > Modified:
> >
> jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
> >  jmeter/trunk/xdocs/changes.xml
> >
> > Modified:
> jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java?rev=1846297=1846296=1846297=diff
> >
> ==
> > ---
> jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
> (original)
> > +++
> jmeter/trunk/src/core/org/apache/jmeter/testelement/property/ObjectProperty.java
> Sat Nov 10 11:21:56 2018
> > @@ -101,7 +101,11 @@ public class ObjectProperty extends Abst
> >*/
> >   @Override
> >   public String getStringValue() {
> > -return value.toString();
> > +if(value != null) {
> > +return value.toString();
> > +} else {
> > +return null;
> > +}
>
> This could be shortened to Objects.toString(value) ;)
>
> Felix
>
> >   }
> >
> >   /**
> >
> > Modified: jmeter/trunk/xdocs/changes.xml
> > URL:
> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1846297=1846296=1846297=diff
> >
> ==
> > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
> > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov 10 11:21:56 2018
> > @@ -197,6 +197,7 @@ of previous time slot as a base. Startin
> >   62795JMeter master sometimes ends distributed test
> even though some of the slaves have not finished
> >   62336396Some shortcuts are not working
> correctly on windows. Contributed by Michael Pavlov (michael.paulau at
> gmail.com)
> >   62889Format JSON Arrays when displayed with JSON
> Path Tester.
> > +62900ObjectProperty#getStringValue() can throw
> NullPointerException
> >   
> >
> >
> >
> >
>


-- 
Cordialement.
Philippe Mouawad.