Search in sources :

Example 6 with PropertyIterator

use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.

the class SimpleConfigGui method configure.

/**
 * A newly created component can be initialized with the contents of a Test
 * Element object by calling this method. The component is responsible for
 * querying the Test Element object for the relevant information to display
 * in its GUI.
 * <p>
 * This implementation retrieves all key/value pairs from the TestElement
 * object and sets these values in the GUI.
 *
 * @param el
 *            the TestElement to configure
 */
@Override
public void configure(TestElement el) {
    super.configure(el);
    tableModel.clearData();
    PropertyIterator iter = el.propertyIterator();
    while (iter.hasNext()) {
        JMeterProperty prop = iter.next();
        tableModel.addRow(new Object[] { prop.getName(), prop.getStringValue() });
    }
    checkDeleteStatus();
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator)

Example 7 with PropertyIterator

use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.

the class UserParametersGui method configure.

@Override
public void configure(TestElement el) {
    initTableModel();
    paramTable.setModel(tableModel);
    UserParameters params = (UserParameters) el;
    CollectionProperty names = params.getNames();
    CollectionProperty threadValues = params.getThreadLists();
    tableModel.setColumnData(0, (List<?>) names.getObjectValue());
    PropertyIterator iter = threadValues.iterator();
    if (iter.hasNext()) {
        tableModel.setColumnData(1, (List<?>) iter.next().getObjectValue());
    }
    int count = 2;
    while (iter.hasNext()) {
        String colName = getUserColName(count);
        tableModel.addNewColumn(colName, String.class);
        tableModel.setColumnData(count, (List<?>) iter.next().getObjectValue());
        count++;
    }
    setColumnWidths();
    perIterationCheck.setSelected(params.isPerIteration());
    super.configure(el);
}
Also used : UserParameters(org.apache.jmeter.modifiers.UserParameters) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator)

Example 8 with PropertyIterator

use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.

the class Arguments method getArgumentsAsMap.

/**
 * Get the arguments as a Map. Each argument name is used as the key, and
 * its value as the value.
 *
 * @return a new Map with String keys and values containing the arguments
 */
public Map<String, String> getArgumentsAsMap() {
    PropertyIterator iter = getArguments().iterator();
    Map<String, String> argMap = new LinkedHashMap<>();
    while (iter.hasNext()) {
        Argument arg = (Argument) iter.next().getObjectValue();
        // elements:
        if (!argMap.containsKey(arg.getName())) {
            argMap.put(arg.getName(), arg.getValue());
        }
    }
    return argMap;
}
Also used : PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) LinkedHashMap(java.util.LinkedHashMap)

Example 9 with PropertyIterator

use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.

the class TestBeanGUI method setValues.

/**
 * Get values from element to fill propertyMap and setup customizer
 * @param element TestElement
 */
private void setValues(TestElement element) {
    // Copy all property values into the map:
    for (PropertyIterator jprops = element.propertyIterator(); jprops.hasNext(); ) {
        JMeterProperty jprop = jprops.next();
        propertyMap.put(jprop.getName(), jprop.getObjectValue());
    }
    if (customizer != null) {
        customizer.setObject(propertyMap);
    } else {
        if (initialized) {
            remove(customizerIndexInPanel);
        }
        Customizer c = customizers.computeIfAbsent(element, e -> {
            Customizer result = createCustomizer();
            result.setObject(propertyMap);
            return result;
        });
        add((Component) c, BorderLayout.CENTER);
    }
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) Customizer(java.beans.Customizer)

Example 10 with PropertyIterator

use of org.apache.jmeter.testelement.property.PropertyIterator in project jmeter by apache.

the class AbstractTestElement method traverse.

@Override
public void traverse(TestElementTraverser traverser) {
    PropertyIterator iter = propertyIterator();
    traverser.startTestElement(this);
    while (iter.hasNext()) {
        traverseProperty(traverser, iter.next());
    }
    traverser.endTestElement(this);
}
Also used : PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator)

Aggregations

PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)36 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)12 CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)8 ArrayList (java.util.ArrayList)4 Argument (org.apache.jmeter.config.Argument)4 HTTPArgument (org.apache.jmeter.protocol.http.util.HTTPArgument)3 Test (org.junit.jupiter.api.Test)3 BasicAttribute (javax.naming.directory.BasicAttribute)2 ModificationItem (javax.naming.directory.ModificationItem)2 NameValuePair (org.apache.http.NameValuePair)2 UrlEncodedFormEntity (org.apache.http.client.entity.UrlEncodedFormEntity)2 BasicNameValuePair (org.apache.http.message.BasicNameValuePair)2 Customizer (java.beans.Customizer)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 File (java.io.File)1 UnsupportedEncodingException (java.io.UnsupportedEncodingException)1 MalformedURLException (java.net.MalformedURLException)1 Charset (java.nio.charset.Charset)1 HashMap (java.util.HashMap)1 LinkedHashMap (java.util.LinkedHashMap)1