Yes. And the field labels in the gui appear as they are defined in the 
properties file, so I'm sure it's being read.

I did a bit more digging after posting. I can see where the "server" 
JMeterProperty is being set: It looks like TestBeanGUI.modifyTestElement is 
transfering the JMeterProperties directly to the element.propMap. But it's 
never calling the setter method on the element.

I assume there should be a propertyDescriptor.getWriteMethod().invoke somewhere 
to call the setter on the element, though I don't know if that's the right 
place to do it. In any case, I can't see anywhere where the setter method is 
being invoked for config elements.




-----Original Message-----
From: sebb [mailto:[email protected]]
Sent: Thu 7/23/2009 5:59 PM
To: JMeter Users List
Subject: Re: getters/setters never called: ConfigTestElement implementing 
TestBean
 
Did you set up the properties?

i.e.

server.displayName
server.shortDescription

On 24/07/2009, Donohue, Jack <[email protected]> wrote:
> I'm new to JMeter. My apologies if this has already been asked/answered.
>  Seems like a basic question, but I couldn't find the answer in any
>  earlier threads.
>
>  I have a problem with a simple ConfigTestElement subclass that
>  implements TestBean. The TestBeanGUI/GenericTestBeanCustomizer displays
>  the properties fine, but the getters/setters are never called:
>
>  e.g.,
>
>  <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>
>
>  The gui displays fine, and a "server" JMeterProperty does get added to
>  the property map with the right value from the gui, but the setter on
>  the actual object is never called.
>
>  Is there anything special need to be done for ConfigElements? The
>  setters do get called for Samplers that implement TestBean.
>
--

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.

Reply via email to