You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2013/10/16 09:58:27 UTC
[Bug 42867] Only default parameters of Java Request Samplers are
stored
https://issues.apache.org/bugzilla/show_bug.cgi?id=42867
--- Comment #3 from Aleksey <al...@mail.ru> ---
I have a same problem. But I can to fix it.
To fix this bug you may apply this patch:
Add this code to the JavaConfigGui.java (version 2.9):
public void actionPerformed(ActionEvent evt) {
...
if (currArgs.getArgumentCount() != 0) {
// Already configured - skip getting defaults
argsPanel.configure(currArgs);
return;
}
...
Full method code:
@Override
public void actionPerformed(ActionEvent evt) {
if (evt.getSource() == classnameCombo) {
String className = ((String)
classnameCombo.getSelectedItem()).trim();
try {
JavaSamplerClient client = (JavaSamplerClient)
Class.forName(className, true,
Thread.currentThread().getContextClassLoader()).newInstance();
Arguments currArgs = new Arguments();
argsPanel.modifyTestElement(currArgs);
if (currArgs.getArgumentCount() != 0) {
// Already configured - skip getting defaults
argsPanel.configure(currArgs);
return;
}
Map<String, String> currArgsMap = currArgs.getArgumentsAsMap();
Arguments newArgs = new Arguments();
Arguments testParams = null;
try {
testParams = client.getDefaultParameters();
} catch (AbstractMethodError e) {
log.warn("JavaSamplerClient doesn't implement "
+ "getDefaultParameters. Default parameters won't
"
+ "be shown. Please update your client class: " +
className);
}
if (testParams != null) {
PropertyIterator i = testParams.getArguments().iterator();
while (i.hasNext()) {
Argument arg = (Argument) i.next().getObjectValue();
String name = arg.getName();
String value = arg.getValue();
// If a user has set parameters in one test, and then
// selects a different test which supports the same
// parameters, those parameters should have the same
// values that they did in the original test.
if (currArgsMap.containsKey(name)) {
String newVal = currArgsMap.get(name);
if (newVal != null && newVal.length() > 0) {
value = newVal;
}
}
newArgs.addArgument(name, value);
}
}
argsPanel.configure(newArgs);
} catch (Exception e) {
log.error("Error getting argument list for " + className, e);
}
}
}
--
You are receiving this mail because:
You are the assignee for the bug.