use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class ArgumentsPanel method createTestElement.
/* Implements JMeterGUIComponent.createTestElement() */
@Override
public TestElement createTestElement() {
Arguments args = new Arguments();
modifyTestElement(args);
return args;
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class ArgumentsPanel method modifyTestElement.
/* Implements JMeterGUIComponent.modifyTestElement(TestElement) */
@Override
public void modifyTestElement(TestElement args) {
GuiUtils.stopTableEditing(table);
if (args instanceof Arguments) {
Arguments arguments = (Arguments) args;
arguments.clear();
// only contains Argument (or HTTPArgument)
@SuppressWarnings("unchecked") Iterator<Argument> modelData = (Iterator<Argument>) tableModel.iterator();
while (modelData.hasNext()) {
Argument arg = modelData.next();
if (StringUtils.isEmpty(arg.getName()) && StringUtils.isEmpty(arg.getValue())) {
continue;
}
// $NON-NLS-1$
arg.setMetaData("=");
arguments.addArgument(arg);
}
}
super.configureTestElement(args);
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class HTTPArgumentsPanel method createTestElement.
@Override
public TestElement createTestElement() {
Arguments args = getUnclonedParameters();
super.configureTestElement(args);
return (TestElement) args.clone();
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class FunctionHelper method actionPerformed.
@Override
public void actionPerformed(ActionEvent e) {
StringBuilder functionCall = new StringBuilder("${");
functionCall.append(functionList.getText());
Arguments args = (Arguments) parameterPanel.createTestElement();
if (args.getArguments().size() > 0) {
functionCall.append("(");
PropertyIterator iter = args.iterator();
boolean first = true;
while (iter.hasNext()) {
Argument arg = (Argument) iter.next().getObjectValue();
if (!first) {
functionCall.append(",");
}
functionCall.append(arg.getValue());
first = false;
}
functionCall.append(")");
}
functionCall.append("}");
cutPasteFunction.setText(functionCall.toString());
CompoundVariable function = new CompoundVariable(functionCall.toString());
resultTextArea.setText(function.execute().trim());
}
use of org.apache.jmeter.config.Arguments in project jmeter by apache.
the class JavaSampler method sample.
/**
* Performs a test sample.
*
* The <code>sample()</code> method retrieves the reference to the Java
* client and calls its <code>runTest()</code> method.
*
* @see JavaSamplerClient#runTest(JavaSamplerContext)
*
* @param entry
* the Entry for this sample
* @return test SampleResult
*/
@Override
public SampleResult sample(Entry entry) {
Arguments args = getArguments();
// Allow Sampler access
args.addArgument(TestElement.NAME, getName());
// to test element name
context = new JavaSamplerContext(args);
if (javaClient == null) {
log.debug(whoAmI() + "\tCreating Java Client");
javaClient = createJavaClient();
javaClient.setupTest(context);
}
SampleResult result = javaClient.runTest(context);
// Only set the default label if it has not been set
if (result != null && result.getSampleLabel().length() == 0) {
result.setSampleLabel(getName());
}
return result;
}
Aggregations