I have answered my own question, though it has taken me a day to figure out what actually happens during JMeter initialisation.
ALL test elements that extend AbstractJDBCTestElement are liable to acquire the GUI TAGS defined in JDBCTestElementBeanInfoSupport's constructor, irrespective of whether they extend JDBCTestElementBeanInfoSupport and over-ride the constructor or whether they extend BeanInfoSupport (one would reasonably expect either technique to enable different behaviour). This is because there is a singleton queryType PropertyDescriptor for all these elements (and presumably the other PropertyDescriptors too), so the GUI constructor merely over-writes the previous values the next time it is invoked. It so happened that my new element got initialised first, so its correct queryType TAGS were overwritten three times by the default queryType TAGS when JDBCPostProcessor, JDBCPreProcessor and JDBCSampler were initialised. If my element had been initialised last, its restricted queryType TAGS would have been imposed on the other element types too! I suspect this behaviour is incorrect but has gone undetected until now because the three standard JDBC test elements were intended to have the same set of properties and TAGS. My solution was to create a new "selectType" property with setSelectType() and getSelectType() methods in the test element, over-ride setQueryType() and getQueryType() to NOOP and apply setHidden(true) to the queryType PropertyDescriptor to make it disappear from the GUI. As "selectType" is unique to my test element, it retains the correct TAGS. I have redefined the constants SELECT and PREPARED_SELECT in my own package since they are not PUBLIC in org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement -----Original Message----- From: Roderick Parks [mailto:roderick.pa...@triometric.net] Sent: 20 March 2012 16:23 To: dev@jmeter.apache.org Subject: Restricting JDBC Query Types in GUI. Hi fellow developers, How can I over-ride the JDBCTestElementBeanInfoSupport constructor successfully, without having to ditch inheritance from AbstractJDBCTestElement? I'm creating a new JDBC test element in JMeter 2.6 but I've hit issues with the GUI. Although I've created test elements before, I've added GUI properties rather than modified them. If I extend JDBCTestElementBeanInfoSupport everything is fine, but I have the full range of query types in the GUI. My requirement is to restrict query type to SELECT or PREPARED_SELECT. Thus I am attempting to over-ride the constructor for the parent class JDBCTestElementBeanInfoSupport.java, ie. public MyJDBCTestElement(Class<?> beanClass) { super(beanClass); // Override default query types PropertyDescriptor p = property("queryType"); // $NON-NLS-1$ p.setValue(NOT_UNDEFINED, Boolean.TRUE); p.setValue(DEFAULT, AbstractJDBCTestElement.SELECT); p.setValue(NOT_OTHER,Boolean.TRUE); p.setValue(TAGS,new String[]{ AbstractJDBCTestElement.SELECT, AbstractJDBCTestElement.PREPARED_SELECT }); } This results in the compiler errors: [javac] SELECT is not public in org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement; cannot be accessed from outside package [javac] PREPARED_SELECT is not public in org.apache.jmeter.protocol.jdbc.AbstractJDBCTestElement; cannot be accessed from outside package The obvious thing to do is simply to redefine these constants locally, but as stated inAbstractJDBCTestElement.java, "These must not be changed, as they are used in the JMX files", so, equally, they should not really be redefined either. Is there a specific reason why these constants are not declared as public and documented on http://jmeter.apache.org/api/constant-values.html? Maybe the answer lies in my next observations.... My constructor over-ride doesn't work - it seems to have no effect. I tried to strip it back by extending BeanInfoSupport instead of JDBCTestElementBeanInfoSupport, and adding only GUI elements that I wanted, but all the original GUI components appear at run-time, exactly as before. Even when I comment out all the JDBC GUI elements in my test element, they still appear at run time. I've established that this is because my new test element extends AbstractJDBCTestElement - the JDBC GUI elements disappear only when I extend AbstractTestElement - ie. the GUI behaviour is due to the test element's inherited type, not its GUI component. So, it appears that simply extending AbstractJDBCTestElement, which is the obvious thing to do when creating a new JDBC test element, automatically implies a relationship to JDBCTestElementBeanInfoSupport, complete with the pre-determined list of "queryType" TAGS created via its constructor. I've verified this by commenting out one of the TAG strings and observing that it disappears in all JDBC test elements, including mine! Hence, my question at the top of the message.... Thanks, Roderick