The existing framework works in the sense that a "server" JMeterProperty
is always created added to the configElement.propMap. 

The problem for me in the example below the "server" attribute is always
null since "setServer" is never actually called on the configElement
itself.

My actual ConfigElement is a bit more complicated, and there was logic
relying on the setServer method to have actually been called, as it
would have been for the other TestBean testelement types. So for me I
was getting a NPE when accessing the "server" attribute.




-----Original Message-----
From: sebb [mailto:seb...@gmail.com] 
Sent: Friday, July 24, 2009 9:35 AM
To: JMeter Developers List
Subject: Re: Possible bug? ConfigElements implementing TestBean: setters
not called

Thanks for the analysis and patch.

I'm just wondering what problem it solves, because the existing
TestBean Config elements work OK?

On 24/07/2009, Donohue, Jack <jack.dono...@fadv.com> wrote:
> I initially posted this problem to the users list, but after a little
>  more digging I think this is a bug. I'm new to JMeter so please
correct
>  me if I'm wrong :-)
>
>
>  To reproduce, deploy the following simple ConfigElement implementing
>  TestBean. The "setServer" method is never called on the element
itself.
>  After a little digging, I believe the problem is that
>  TestBeanHelper.prepare(element) is never called on any config
elements.
>  TestBeanHelper.prepare() seems to get called on every other kind of
test
>  element (samplers, etc.), but not config elements.
>
>
>  Attached is a proposed patch to ensure that TestBeanHelper.prepare()
is
>  also called for all ConfigElements. I'm not certain this is the right
>  place to do this, but it seems roughly consistent with how it is
called
>  for other element types.
>
>
>
>  <code>
>  public class MyConfig extends ConfigTestElement implements TestBean {
>
>         private String server = null;
>
>     public String getServer() {
>         // this is never called
>         return server;
>     }
>
>     public void setServer(String val) {
>         // this is never called
>         server = val;
>     }
>  }
>
>  public class MyConfigBeanInfo extends BeanInfoSupport {
>
>     Logger log = LoggingManager.getLoggerForClass();
>
>     public MyConfigBeanInfo() {
>         super(MyConfig.class);
>
>         PropertyDescriptor p = property("server");
>         p.setValue(NOT_UNDEFINED, Boolean.TRUE);
>         p.setValue(DEFAULT, "localhost");
>
>     }
>  }
>
>  </code>
>
>
>
>
>  --
>
>  THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED
SOLELY FOR THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN
CONFIDENTIAL, PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE
ADDRESSEE INDICATED IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS
MESSAGE TO SUCH PERSON) YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE
THIS MESSAGE OR ANY FILES TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS
MESSAGE IN ERROR, PLEASE CONTACT THE SENDER BY REPLY E-MAIL AND DELETE
THIS MESSAGE AND ALL COPIES OF IT FROM YOUR SYSTEM.
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
>  For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org


--

THIS E-MAIL MESSAGE AND ANY FILES TRANSMITTED HEREWITH, ARE INTENDED SOLELY FOR 
THE USE OF THE INDIVIDUAL(S) ADDRESSED AND MAY CONTAIN CONFIDENTIAL, 
PROPRIETARY OR PRIVILEGED INFORMATION.  IF YOU ARE NOT THE ADDRESSEE INDICATED 
IN THIS MESSAGE (OR RESPONSIBLE FOR DELIVERY OF THIS MESSAGE TO SUCH PERSON) 
YOU MAY NOT REVIEW, USE, DISCLOSE OR DISTRIBUTE THIS MESSAGE OR ANY FILES 
TRANSMITTED HEREWITH.  IF YOU RECEIVE THIS MESSAGE IN ERROR, PLEASE CONTACT THE 
SENDER BY REPLY E-MAIL AND DELETE THIS MESSAGE AND ALL COPIES OF IT FROM YOUR 
SYSTEM.


---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-h...@jakarta.apache.org

Reply via email to