Bug 57381 - HTTP(S) Test Script Recorder should display an error if Target Controller references a Recording Controller and no Recording Controller exists

Bugzilla Id: 57381

git-svn-id: https://svn.apache.org/repos/asf/jmeter/trunk@1648056 13f79535-47bb-0310-9956-ffa450edef68

Former-commit-id: 07e18d87ed
This commit is contained in:
Philippe Mouawad 2014-12-27 15:22:01 +00:00
parent 507dc642dc
commit b94f9ef53f
4 changed files with 21 additions and 1 deletions

View File

@ -43,4 +43,11 @@ public final class TreeNodeWrapper {
public String toString() {
return label;
}
/**
* @return the label
*/
public String getLabel() {
return label;
}
}

View File

@ -991,7 +991,7 @@ public class ProxyControl extends GenericController {
* @return the tree node for the controller where the proxy must store the
* generated samplers.
*/
private JMeterTreeNode findTargetControllerNode() {
public JMeterTreeNode findTargetControllerNode() {
JMeterTreeNode myTarget = getTarget();
if (myTarget != null) {
return myTarget;

View File

@ -66,6 +66,7 @@ import org.apache.jmeter.gui.util.HorizontalPanel;
import org.apache.jmeter.gui.util.MenuFactory;
import org.apache.jmeter.gui.util.PowerTableModel;
import org.apache.jmeter.gui.util.VerticalPanel;
import org.apache.jmeter.protocol.http.control.RecordingController;
import org.apache.jmeter.protocol.http.proxy.ProxyControl;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
import org.apache.jmeter.testelement.TestElement;
@ -486,6 +487,17 @@ public class ProxyControlGui extends LogicControllerGui implements JMeterGUIComp
private void startProxy() {
ValueReplacer replacer = GuiPackage.getInstance().getReplacer();
modifyTestElement(model);
TreeNodeWrapper treeNodeWrapper = (TreeNodeWrapper)targetNodesModel.getSelectedItem();
if (JMeterUtils.getResString("use_recording_controller").equals(treeNodeWrapper.getLabel())) {
JMeterTreeNode targetNode = model.findTargetControllerNode();
if(targetNode == null || !(targetNode.getTestElement() instanceof RecordingController)) {
JOptionPane.showMessageDialog(this,
JMeterUtils.getResString("proxy_cl_wrong_target_cl"), // $NON-NLS-1$
JMeterUtils.getResString("error_title"), // $NON-NLS-1$
JOptionPane.ERROR_MESSAGE);
return;
}
}
// Proxy can take some while to start up; show a wating cursor
Cursor cursor = getCursor();
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));

View File

@ -182,6 +182,7 @@ See <bugzilla>56357</bugzilla> for details.
<h3>HTTP Samplers and Test Script Recorder</h3>
<ul>
<li><bug>25430</bug>HTTP(S) Test Script Recorder : Make it populate HTTP Authorisation Manager. Partly based on a patch from Dzmitry Kashlach (dzmitrykashlach at gmail.com)</li>
<li><bug>57381</bug>HTTP(S) Test Script Recorder should display an error if Target Controller references a Recording Controller and no Recording Controller exists. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
</ul>
<h3>Other samplers</h3>