- Check out branch testbeans_experimental_branch - Build & run - Right-click on Workbench -> Add -> Sampler -> HTTPSamplerBean - See the automatically-generated GUI.
The component probably doesn't work. Of course I'll need to fix this before declaring the proof-of-concept complete.
Understanding the thing:
To start with, forget about all the changes in the core packages for the time being. Let's focus in the HTTPSamplerBean class, which is a port to the new concept of the HTTPSampler class in the Root_testbeans_experimental_branch version.
HTTPSamplerBean is exactly the same as the HTTPSampler except that:
- It longer uses those JMeterProperties, but regular, familiar Java Bean properties instead.
- It subclasses TestBean and implements Sampler instead of subclassing AbstractSampler. It would be trivial to create an AbstractSamplerBean class to play the role of the AbstractSampler.
- sample() now calls "prepare()" first thing. This is important, but my idea is to change the engine to do this call. [Or I could have sample(Entry) call it in the above-mentioned AbstractSamplerBean, which would declare sample(Entry) final and sample() abstract.]
I don't think I've done any other relevant changes (well, I've tried not to).
The resulting class is obviously simpler than the original HTTPSampler, but really not that much. The obvious advantage is in the GUI classes.
The GUI is based in two classes only: HTTPSamplerBeanBeanInfo (4 lines of code) and HTTPArgumentsEditor (3 lines). They are necessary because the HTTPSampler is a particularly complex test element, in that its GUI has an embedded ArgumentsPanel, that is: the GUI for another test element is embedded here. I chose it precisely because of this complexity: I wanted to prove that the two approaches (old-style testelements and TestBeans) can interoperate fully.
The BeanInfo class will grow significantly larger before the proof-of-concept is complete, but I wanted you to have a look at this when it's still this simple -- it's a good example for what a developer prototyping a new component will need to do.
About the additions I've done in the core packages, feel free to have a look, but I don't think it's that important now. The bits that are not about handling the GUI are about maintaining compatibility with the current approach. For example, TestBean is now a subclass of TestElement, but it doesn't really need to be in the future: we will be able to keep the bean and it's "description" (the propertie's values or expressions to be used to compute them) separate.
Constructive and destructive comments welcome.
-- Salut,
Jordi.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
