Bug 38687 - Module controller does not work in non-GUI mode
Summary: Module controller does not work in non-GUI mode
Alias: None
Product: JMeter
Classification: Unclassified
Component: Main (show other bugs)
Version: 2.1.1
Hardware: All other
: P1 normal with 1 vote (vote)
Target Milestone: ---
Assignee: JMeter issues mailing list
Depends on:
Reported: 2006-02-16 21:59 UTC by Sebb
Modified: 2007-09-02 04:47 UTC (History)
0 users

Correction (73.11 KB, patch)
2006-09-18 11:51 UTC, Guillaume Lasnier
Details | Diff
Correction patch for R2.3 (14.49 KB, patch)
2007-08-31 00:53 UTC, Christoph
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Sebb 2006-02-16 21:59:10 UTC
The Module Controller does not work in non-GUI mode.

This seems to be because it uses the GuiPackage to find the test tree.

Although non-GUI test runs cannot access WorkBench items, the Module 
Controller can also refer to modules defined in the current thread-group, even 
if these are disabled or as children of an If controller with a permanently 
false condition.
Comment 1 Sebb 2006-02-17 20:42:37 UTC
It seems that the ReplaceableController interface special handling is done 
only in the AbstractAction class - which is currently only called in GUI mode.
Comment 2 peter lin 2006-02-17 20:51:05 UTC
so it sounds like we need a general solution that will work for both module and
include controller

Comment 3 Guillaume Lasnier 2006-09-15 08:20:44 UTC
The issue only applies to the Module Controller. Include Controller are
correclty resolved resolved in non GUI mode.
Has someone started to work on this issue?
Comment 4 Guillaume Lasnier 2006-09-18 11:51:15 UTC
Created attachment 18880 [details]

This patch fixes the problem by adding a method to ReplaceableController to
help resolving the replacement subtree. Resolution takes an generic Object,
which is used by ModuleController to search for the selected test element.
Initially this resolution was kind of hacky since it looked for the root node
in the GuiPackage. This works fine in GUI mode but as mentionned in your
comments is not suitable in non GUI. In this mode, resolution is performed just
after load the TestPlan in the JMeter class.
The conversion of Test node has also been refactored in the JMeter class.
Comment 5 Christoph 2007-08-31 00:53:10 UTC
Created attachment 20749 [details]
Correction patch for R2.3

i made a new patch against release 2.3 by using your patch, as we need that for
our application. this patch may be easily applied to release 2.3 (and is only
15 kb and not 73 kb).
Comment 6 Sebb 2007-08-31 09:53:53 UTC
Excellent - thanks very much.

The patch (20749) works fine.

I've applied it with a minor tweak - convertSubTree() is no longer needed in 

SVN updates: r571515 r571519 r571520

Also r571514 - update to test code to demonstrate bug.
Comment 7 Sebb 2007-09-02 04:46:50 UTC
I found a problem with the code when running non-GUI on a box without a real 
display. Setting java.awt.headless=true fixed it, but this is not a full 

The cause of the problem is in JMeterTreeModel, which creates various Gui 
objects. This is needed by ReplaceableController.resolveReplacementSubTree().

Changing the tree resolver to use the testPlan HashTree rather than 
JMeterTreeNode looked rather difficult, so I added a hack to create a 
TreeModel that does not use any GUI items.
Comment 8 Sebb 2007-09-02 04:47:39 UTC
This should probably be tidied up at some point...