Search in sources :

Example 16 with CollectionProperty

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

the class DistributedTestControl method getData.

public CollectionProperty getData() {
    CollectionProperty data = (CollectionProperty) getProperty(DATA_PROP);
    LinkedList<String> arr = new LinkedList<String>();
    for (int n = 0; n < data.size(); n++) {
        arr.add(data.get(n).getStringValue());
    }
    String val = StringUtils.join(arr, ",");
    log.debug("Setting hosts 1: " + val);
    JMeterUtils.setProperty(PROP_HOSTS, val);
    return data;
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) LinkedList(java.util.LinkedList)

Example 17 with CollectionProperty

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

the class FreeFormArrivalsThreadGroupGui method updateChart.

protected void updateChart(AbstractDynamicThreadGroup tg) {
    FreeFormArrivalsThreadGroup atg = (FreeFormArrivalsThreadGroup) tg;
    CollectionProperty data = atg.getData();
    chartModel.clear();
    previewChart.clearErrorMessage();
    AbstractGraphRow row = new GraphRowExactValues();
    row.setColor(getRowColor());
    row.setDrawLine(true);
    row.setMarkerSize(AbstractGraphRow.MARKER_SIZE_NONE);
    row.setDrawThickLines(true);
    // initial value to force min Y
    row.add(0, 0);
    JMeterVariableEvaluator evaluator = new JMeterVariableEvaluator();
    int offset = 0;
    double totalArrivals = 0;
    PropertyIterator it = data.iterator();
    while (it.hasNext()) {
        CollectionProperty record = (CollectionProperty) it.next();
        double from = evaluator.getDouble(record.get(0));
        double to = evaluator.getDouble(record.get(1));
        double during = evaluator.getDouble(record.get(2));
        row.add(offset * 1000, from);
        offset += during * tg.getUnitFactor();
        row.add(offset * 1000, to);
        totalArrivals += during * from + during * (to - from) / 2;
    }
    previewChart.setxAxisLabelRenderer(new DateTimeRenderer(DateTimeRenderer.HHMMSS, 0));
    chartModel.put(getRowLabel(totalArrivals), row);
}
Also used : AbstractGraphRow(kg.apc.charting.AbstractGraphRow) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) DateTimeRenderer(kg.apc.charting.DateTimeRenderer) PropertyIterator(org.apache.jmeter.testelement.property.PropertyIterator) JMeterVariableEvaluator(kg.apc.jmeter.JMeterVariableEvaluator) GraphRowExactValues(kg.apc.charting.rows.GraphRowExactValues)

Example 18 with CollectionProperty

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

the class ServersListPanel method loadFromTestElement.

public void loadFromTestElement(DistributedTestControl te) {
    CollectionProperty servers = te.getData();
    log.debug("Loading: " + servers.toString());
    clear();
    for (int n = 0; n < servers.size(); n++) {
        log.debug("Adding: " + servers.get(n).toString());
        add(servers.get(n).getStringValue());
    }
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty)

Example 19 with CollectionProperty

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

the class MergeResultsGui method modifyTestElement.

/**
 * Modifies a given TestElement to mirror the data in the gui components.
 *
 * @see org.apache.jmeter.gui.JMeterGUIComponent#modifyTestElement(TestElement)
 */
@Override
public void modifyTestElement(TestElement c) {
    super.modifyTestElement(c);
    if (c instanceof ResultCollector) {
        ResultCollector rc = (ResultCollector) c;
        rc.setFilename(getFile());
        rc.setProperty(new StringProperty(CorrectedResultCollector.FILENAME, getFile()));
        CollectionProperty rows = JMeterPluginsUtils.tableModelRowsToCollectionProperty(tableModel, DATA_PROPERTY);
        rc.setProperty(rows);
        collector = rc;
    }
}
Also used : CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) StringProperty(org.apache.jmeter.testelement.property.StringProperty) ResultCollector(org.apache.jmeter.reporters.ResultCollector)

Example 20 with CollectionProperty

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

the class MergeResultsGui method configure.

@Override
public void configure(TestElement el) {
    super.configure(el);
    setFile(el.getPropertyAsString(CorrectedResultCollector.FILENAME));
    JMeterProperty fileValues = el.getProperty(DATA_PROPERTY);
    if (!(fileValues instanceof NullProperty)) {
        CollectionProperty columns = (CollectionProperty) fileValues;
        tableModel.removeTableModelListener(this);
        JMeterPluginsUtils.collectionPropertyToTableModelRows(columns, tableModel, columnClasses);
        tableModel.addTableModelListener(this);
        updateUI();
    } else {
        log.warn("Received null property instead of collection");
    }
    checkDeleteButtonStatus();
    checkMergeButtonStatus();
    startTimeRef = 0;
}
Also used : JMeterProperty(org.apache.jmeter.testelement.property.JMeterProperty) CollectionProperty(org.apache.jmeter.testelement.property.CollectionProperty) NullProperty(org.apache.jmeter.testelement.property.NullProperty)

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