Search in sources :

Example 61 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class FirefoxDriverConfig method setPreferences.

private void setPreferences(FirefoxProfile profile) {
    JMeterProperty property = getProperty(PREFERENCES);
    if (property instanceof NullProperty) {
        return;
    }
    CollectionProperty rows = (CollectionProperty) property;
    for (int i = 0; i < rows.size(); i++) {
        ArrayList row = (ArrayList) rows.get(i).getObjectValue();
        String name = ((JMeterProperty) row.get(0)).getStringValue();
        String value = ((JMeterProperty) row.get(1)).getStringValue();
        switch(value) {
            case "true":
                profile.setPreference(name, true);
                break;
            case "false":
                profile.setPreference(name, false);
                break;
            default:
                profile.setPreference(name, value);
                break;
        }
    }
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) NullProperty(org.apache.jmeter.testelement.property.NullProperty) ArrayList(java.util.ArrayList)

Example 62 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class FirefoxDriverConfig method setPreferences.

public void setPreferences(PowerTableModel model) {
    CollectionProperty prop = JMeterPluginsUtils.tableModelRowsToCollectionProperty(model, PREFERENCES);
    setProperty(prop);
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 63 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class MonitoringResultsCollector method getSamplerSettings.

public CollectionProperty getSamplerSettings() {
    JMeterProperty prop = getProperty(DATA_PROPERTY);
    if (!(prop instanceof CollectionProperty)) {
        log.warn("Got unexpected property: " + prop);
        // empty collection instead of NullProperty
        return new CollectionProperty();
    }
    CollectionProperty rows = (CollectionProperty) prop;
    return rows;
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 64 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class JMeterPluginsUtils method tableModelRowsToCollectionProperty.

public static CollectionProperty tableModelRowsToCollectionProperty(PowerTableModel model, String propname) {
    CollectionProperty rows = new CollectionProperty(propname, new ArrayList<>());
    for (int row = 0; row < model.getRowCount(); row++) {
        List<Object> item = getArrayListForArray(model.getRowData(row));
        rows.addItem(item);
    }
    return rows;
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 65 with CollectionProperty

use of org.apache.jmeter.testelement.property.CollectionProperty in project jmeter-plugins by undera.

the class AbstractMonitoringVisualizer method modifyTestElement.

@Override
public void modifyTestElement(TestElement te) {
    super.modifyTestElement(te);
    if (grid.isEditing()) {
        grid.getCellEditor().stopCellEditing();
    }
    if (te instanceof MonitoringResultsCollector) {
        MonitoringResultsCollector mrc = (MonitoringResultsCollector) te;
        CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(tableModel, MonitoringResultsCollector.DATA_PROPERTY);
        mrc.setData(rows);
    }
    super.configureTestElement(te);
}
Also used : MonitoringResultsCollector(kg.apc.jmeter.vizualizers.MonitoringResultsCollector) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Aggregations

CollectionProperty (org.apache.jmeter.testelement.property.CollectionProperty)91 JMeterProperty (org.apache.jmeter.testelement.property.JMeterProperty)29 ArrayList (java.util.ArrayList)19 NullProperty (org.apache.jmeter.testelement.property.NullProperty)13 Test (org.junit.Test)11 PropertyIterator (org.apache.jmeter.testelement.property.PropertyIterator)8 Test (org.junit.jupiter.api.Test)7 IOException (java.io.IOException)5 List (java.util.List)4 StringProperty (org.apache.jmeter.testelement.property.StringProperty)4 File (java.io.File)3 Argument (org.apache.jmeter.config.Argument)3 PowerTableModel (org.apache.jmeter.gui.util.PowerTableModel)3 TestPlan (org.apache.jmeter.testelement.TestPlan)3 UnsupportedEncodingException (java.io.UnsupportedEncodingException)2 Field (java.lang.reflect.Field)2 MalformedURLException (java.net.MalformedURLException)2 URL (java.net.URL)2 UnknownHostException (java.net.UnknownHostException)2 LinkedList (java.util.LinkedList)2