Bug 53042 - Introduce a new Interface to be implemented by AbstractSampler to allow Sampler to decide wether a config element applies to Sampler
Introduce a new Interface to be implemented by AbstractSampler to allow Sampl...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
Nightly (Please specify date)
All All
: P2 enhancement (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on:
Blocks: 50799 53027
  Show dependency tree
 
Reported: 2012-04-05 21:32 UTC by Philippe Mouawad
Modified: 2012-04-07 12:20 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Philippe Mouawad 2012-04-05 21:32:16 UTC
r1293562 > JMeter 2.6

Enhancement based on Sebb idea on mailing list:


Philippe Mouawad wrote:
I agree, although reading again my sentence I see it's not clear.

If a new ConfigElement is added then there is not need that existing sampler accept it,while the reverse is true.
So the master if the sampler not the config element.





On Sun, Feb 26, 2012 at 1:52 PM, sebb  wrote:

    On 26 February 2012 10:01, Philippe Mouawad  wrote:
    > Very good idea.
    > I would rather go for a method to determine if a config element applies to
    > Sampler.

    Thinking further about this:

    A single config element applies to many samplers; add a new sampler
    and it may re-use the same config element (with different GUI).
    So I think it must be the sampler that has a method to check if the
    config element applies or not, based on the config class and GUI
    class.

    We need to ensure that any change does not stop 3rd party samplers
    (and config elements) from working.

    One way might be to add a new interface to define the method; samplers
    that want to restrict which config elements apply to them would need
    to implement the method.

    There could be a default implementation in AbstractSampler that
    accepted all config elements (to retain backward compat).

    I think this would be OK for 3rd party samplers, except for the case
    where a sampler extended an existing JMeter sampler, and also had its
    own config element.

    Or are there any other cases that might be affected?

    Another possible approach might be for samplers to register which
    config elements apply to them; this would be a bit harder to code -
    and might not be efficient enough - but would potentially allow for
    customisation (e.g. using properties) when starting JMeter. This would
    allow overrides for 3rd party samplers.

    Or maybe somehow combine the two: before finally rejecting the config
    element, a sampler checks for any overrides that have been registered.

    As a fallback, we could/should use a property to disable the config
    element filtering, in case it turns out to have unwanted side-effects.

    > Regards
    > Philippe
    >
    > On Thu, Feb 23, 2012 at 11:48 PM, sebb  wrote:
    >
    >> The proposed patch works by skipping CSVDataSet when merging in the
    >> configuration elements.
    >>
    >> ConfigTestElements have to be merged into samplers, in order that the
    >> samplers can pick up the configuration elements that apply to them.
    >>
    >> This means that all samplers are provided with all the data from every
    >> config element in scope. This was perhaps OK initially, when there
    >> weren't many samplers, but now there are lots of samplers and lots of
    >> config elements.
    >>
    >> Duplication of names is now more difficult to avoid, and there is more
    >> wasted space; each sampler only needs the settings from some of the
    >> config elements.
    >>
    >> It would be nice if there were a method on the config element that
    >> specified which samplers it applied to - or equally, if samplers had a
    >> method to determine if a config element applied to them.
    >>
    >> However, I don't know if there is an easy way to determine which
    >> config elements apply to which samplers.
    >>
    >> Some specific configs are obvious, such as CSVDataSet, which is not
    >> directly associated with any Sampler. The same probably applies to
    >> RandomVariableConfig.
    >>
    >> AuthManager, CookieManager etc only apply to HTTP samplers.
    >>
    >> But there are a lot of sampler configurations that use the basic
    >> ConfigTestElement; I suppose it might be possible to use the
    >> TestElement.gui_class String property.
    >>
    >> This needs a bit more thought...
    >>
    >
    >
Comment 1 Philippe Mouawad 2012-04-05 21:36:21 UTC
Date: Thu Apr  5 21:35:32 2012
New Revision: 1310078

URL: http://svn.apache.org/viewvc?rev=1310078&view=rev
Log:
Bug 53042 - Introduce a new method in Sampler interface to allow Sampler to decide wether a config element applies to Sampler

Modified:
   jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampler.java
   jmeter/trunk/src/core/org/apache/jmeter/samplers/Sampler.java
   jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BSFSampler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JSR223Sampler.java
   jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
   jmeter/trunk/xdocs/changes.xml
Comment 2 Philippe Mouawad 2012-04-07 12:20:05 UTC
Date: Sat Apr  7 12:19:19 2012
New Revision: 1310745

URL: http://svn.apache.org/viewvc?rev=1310745&view=rev
Log:
Bug 53042 - Introduce a new Interface to be implemented by AbstractSampler to allow Sampler to decide wether a config element applies to Sampler

Also made ConfigTestElement that have SimpleConfigGui as GUI_CLASS be applied where they returned false before

Added:
   jmeter/trunk/src/core/org/apache/jmeter/engine/util/ConfigMergabilityIndicator.java   (with props)
Modified:
   jmeter/trunk/src/core/org/apache/jmeter/samplers/AbstractSampler.java
   jmeter/trunk/src/core/org/apache/jmeter/samplers/Sampler.java
   jmeter/trunk/src/core/org/apache/jmeter/threads/TestCompiler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BSFSampler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/BeanShellSampler.java
   jmeter/trunk/src/protocol/java/org/apache/jmeter/protocol/java/sampler/JSR223Sampler.java
   jmeter/trunk/src/protocol/jdbc/org/apache/jmeter/protocol/jdbc/sampler/JDBCSampler.java
   jmeter/trunk/src/protocol/mail/org/apache/jmeter/protocol/smtp/sampler/SmtpSampler.java
   jmeter/trunk/xdocs/changes.xml