use of org.apache.jmeter.config.Argument 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.Argument in project jmeter by apache.
the class ArgumentsPanel method createArgumentFromClipboard.
protected Argument createArgumentFromClipboard(String[] clipboardCols) {
Argument argument = makeNewArgument();
argument.setName(clipboardCols[0]);
if (clipboardCols.length > 1) {
argument.setValue(clipboardCols[1]);
if (clipboardCols.length > 2) {
argument.setDescription(clipboardCols[2]);
}
}
return argument;
}
use of org.apache.jmeter.config.Argument in project jmeter by apache.
the class AnchorModifier method modifyArgument.
private void modifyArgument(Argument arg, Arguments args) {
if (log.isDebugEnabled()) {
log.debug("Modifying argument: " + arg);
}
List<Argument> possibleReplacements = new ArrayList<>();
PropertyIterator iter = args.iterator();
Argument replacementArg;
while (iter.hasNext()) {
replacementArg = (Argument) iter.next().getObjectValue();
try {
if (HtmlParsingUtils.isArgumentMatched(replacementArg, arg)) {
possibleReplacements.add(replacementArg);
}
} catch (Exception ex) {
log.error("Problem adding Argument", ex);
}
}
if (!possibleReplacements.isEmpty()) {
replacementArg = possibleReplacements.get(ThreadLocalRandom.current().nextInt(possibleReplacements.size()));
arg.setName(replacementArg.getName());
arg.setValue(replacementArg.getValue());
if (log.isDebugEnabled()) {
log.debug("Just set argument to values: " + arg.getName() + " = " + arg.getValue());
}
args.removeArgument(replacementArg);
}
}
use of org.apache.jmeter.config.Argument in project jmeter by apache.
the class LDAPSampler method getUserAttributes.
/**
* Collect all the value from the table (Arguments), using this create the
* basicAttributes. This will create the Basic Attributes for the User
* defined TestCase for Add Test.
*
* @return the BasicAttributes
*/
private BasicAttributes getUserAttributes() {
//$NON-NLS-1$
BasicAttribute basicattribute = new BasicAttribute("objectclass");
//$NON-NLS-1$
basicattribute.add("top");
//$NON-NLS-1$
basicattribute.add("person");
//$NON-NLS-1$
basicattribute.add("organizationalPerson");
//$NON-NLS-1$
basicattribute.add("inetOrgPerson");
BasicAttributes attrs = new BasicAttributes(true);
attrs.put(basicattribute);
BasicAttribute attr;
for (JMeterProperty jMeterProperty : getArguments()) {
Argument item = (Argument) jMeterProperty.getObjectValue();
attr = getBasicAttribute(item.getName(), item.getValue());
attrs.put(attr);
}
return attrs;
}
use of org.apache.jmeter.config.Argument 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());
}
Aggregations