Search in sources :

Example 6 with MapResultData

use of org.apache.jmeter.report.processor.MapResultData in project jmeter by apache.

the class AbstractDataExporter method findValue.

/**
 * Finds a value matching the specified data name in a ResultData tree.
 * Supports only MapResultData walking.
 *
 * @param clazz
 *            the type of the value
 * @param data
 *            the name of the data containing the value
 * @param root
 *            the root of the tree
 * @param <T>
 *            type of value to be found
 * @return the value matching the data name
 */
protected static <T> T findValue(Class<T> clazz, String data, ResultData root) {
    T value = null;
    ResultData result = findData(data, root);
    if (result instanceof ValueResultData) {
        ValueResultData valueResult = (ValueResultData) result;
        Object object = valueResult.getValue();
        if (object != null && clazz.isAssignableFrom(object.getClass())) {
            value = clazz.cast(object);
        }
    }
    return value;
}
Also used : MapResultData(org.apache.jmeter.report.processor.MapResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData) ResultData(org.apache.jmeter.report.processor.ResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 7 with MapResultData

use of org.apache.jmeter.report.processor.MapResultData in project jmeter by apache.

the class SyntheticResponseTimeDistributionGraphConsumer method create.

private MapResultData create(String serie, String color) {
    GroupInfo groupInfo = getGroupInfos().get(AbstractGraphConsumer.DEFAULT_GROUP);
    SeriesData seriesData = new SeriesData(groupInfo.getAggregatorFactory(), groupInfo.enablesAggregatedKeysSeries(), false, groupInfo.enablesOverallSeries());
    MapResultData seriesResult = createSerieResult(serie, seriesData);
    seriesResult.setResult(SERIE_COLOR_PROPERTY, new ValueResultData(color));
    return seriesResult;
}
Also used : SeriesData(org.apache.jmeter.report.processor.graph.SeriesData) GroupInfo(org.apache.jmeter.report.processor.graph.GroupInfo) MapResultData(org.apache.jmeter.report.processor.MapResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData)

Example 8 with MapResultData

use of org.apache.jmeter.report.processor.MapResultData in project jmeter by apache.

the class AbstractGraphConsumer method stopConsuming.

/*
     * (non-Javadoc)
     *
     * @see
     * org.apache.jmeter.report.csv.processor.SampleConsumer#stopConsuming()
     */
/*
     * (non-Javadoc)
     *
     * @see
     * org.apache.jmeter.report.processor.graph.SampleConsumer#stopConsuming()
     */
@Override
public void stopConsuming() {
    super.stopProducing();
    MapResultData result = createResult();
    // Get the aggregate results from the map
    for (Map.Entry<String, GroupInfo> groupEntry : groupInfos.entrySet()) {
        String groupName = groupEntry.getKey();
        GroupInfo groupInfo = groupEntry.getValue();
        GroupData groupData = groupInfo.getGroupData();
        boolean overallSeries = groupInfo.enablesOverallSeries();
        boolean aggregatedKeysSeries = groupInfo.enablesAggregatedKeysSeries();
        for (Map.Entry<String, SeriesData> seriesEntry : groupData.getSeriesInfo().entrySet()) {
            String seriesName = seriesEntry.getKey();
            SeriesData seriesData = seriesEntry.getValue();
            addKeyData(result, groupName, seriesName, seriesData, false);
            if (aggregatedKeysSeries) {
                addKeyData(result, groupName, seriesName, seriesData, true);
            }
        }
        // Add overall values if needed
        if (overallSeries) {
            SeriesData overallData = groupData.getOverallSeries();
            String overallSeriesName = String.format(overallSeriesFormat, groupName);
            addKeyData(result, groupName, overallSeriesName, overallData, false);
            if (aggregatedKeysSeries) {
                addKeyData(result, groupName, overallSeriesName, overallData, true);
            }
        }
    }
    // Store the result
    setDataToContext(getName(), result);
    for (GroupInfo groupInfo : groupInfos.values()) {
        groupInfo.getGroupData().clear();
    }
}
Also used : MapResultData(org.apache.jmeter.report.processor.MapResultData) TreeMap(java.util.TreeMap) Map(java.util.Map) HashMap(java.util.HashMap)

Example 9 with MapResultData

use of org.apache.jmeter.report.processor.MapResultData in project jmeter by apache.

the class AbstractGraphConsumer method createSerieResult.

/**
 * @param series     The series name
 * @param seriesData {@link SeriesData}
 * @return MapResultData metadata for serie
 */
protected MapResultData createSerieResult(String series, SeriesData seriesData) {
    MapResultData seriesResult = new MapResultData();
    seriesResult.setResult(RESULT_SERIES_NAME, new ValueResultData(series));
    seriesResult.setResult(RESULT_SERIES_IS_CONTROLLER, new ValueResultData(seriesData.isControllersSeries()));
    seriesResult.setResult(RESULT_SERIES_IS_OVERALL, new ValueResultData(seriesData.isOverallSeries()));
    seriesResult.setResult(RESULT_SERIES_DATA, new ListResultData());
    return seriesResult;
}
Also used : MapResultData(org.apache.jmeter.report.processor.MapResultData) ValueResultData(org.apache.jmeter.report.processor.ValueResultData) ListResultData(org.apache.jmeter.report.processor.ListResultData)

Aggregations

MapResultData (org.apache.jmeter.report.processor.MapResultData)9 ValueResultData (org.apache.jmeter.report.processor.ValueResultData)6 ListResultData (org.apache.jmeter.report.processor.ListResultData)4 HashMap (java.util.HashMap)3 Map (java.util.Map)2 TreeMap (java.util.TreeMap)2 ResultData (org.apache.jmeter.report.processor.ResultData)2 ObjectWriter (com.fasterxml.jackson.databind.ObjectWriter)1 File (java.io.File)1 IOException (java.io.IOException)1 Writer (java.io.Writer)1 Aggregator (org.apache.jmeter.report.processor.Aggregator)1 GroupInfo (org.apache.jmeter.report.processor.graph.GroupInfo)1 SeriesData (org.apache.jmeter.report.processor.graph.SeriesData)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1