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