Hi all,
I am writing an extension to jmeter and try to achieve the following :
When I navigate to a sampler in the gui, I want the samplergui to locate the
previous sampler in the test tree and show some information of this previous
sampler.
I tried to add the following code to the configure(TestElement element)
method of the sample :
configure(TestElement element) {
TestElement testElement;
GuiPackage pack = GuiPackage.getInstance();
JMeterTreeNode thisNode = (JMeterTreeNode)
pack.getTreeModel().getNodeOf(element);
if (thisNode != null) {
DefaultMutableTreeNode previousSamplerNode =
thisNode.getPreviousSibling();
testElement = (TestElement) thisNode.getUserObject();
}
}
Only the first sampler can be found (thisNode != null). For the other
samplers getNodeOf(element) evaluates to false : the testelement can't be
found in the treemodel. Apparently the expression (userObject ==
node.getUserObject()) in the JMeterTreeModel.traverseAndFind method
evaluates to false.
Is this the right way to locate the previous sampler of a given sampler ?
If not, does anyone have another solution ?
And can the same procedure be used to locate the previous sampler while
running the tests ?
I am looking forward to your replies.
Steven Barendregt
--
****************************************************************************
This message contains information that may be privileged or confidential and
is the property of the Cap Gemini Ernst & Young Group. It is only intended
for the person to whom it is addressed. If you are not the intended
recipient, you are not authorized to read, print, retain, copy disseminate,
distribute, or use this message or any part thereof. If you receive this
message in error, please notify the sender immediately and delete all copies
of this message.
****************************************************************************