jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fschumac...@apache.org
Subject svn commit: r1719185 [6/8] - in /jmeter/trunk/src/core/org/apache/jmeter/report: config/ core/ dashboard/ processor/ processor/graph/ processor/graph/impl/
Date Thu, 10 Dec 2015 19:10:08 GMT
Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java Thu Dec 10 19:10:06 2015
@@ -1,548 +1,548 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Objects;
-import java.util.TreeMap;
-
-import org.apache.jmeter.report.core.Sample;
-import org.apache.jmeter.report.processor.AbstractSampleConsumer;
-import org.apache.jmeter.report.processor.Aggregator;
-import org.apache.jmeter.report.processor.AggregatorFactory;
-import org.apache.jmeter.report.processor.ListResultData;
-import org.apache.jmeter.report.processor.MapResultData;
-import org.apache.jmeter.report.processor.ValueResultData;
-
-/**
- * <p>
- * The class AbstractGraphConsumer provides a consumer that build a sorted map
- * from samples. It uses a projection to define the key (x-axis coordinate) and
- * an aggregator to define the value (y-axis coordinate).
- * </p>
- * 
- * <p>
- * <b>About the seriesData :</b><br>
- * Series are defined by the seriesSelector, so they can be static or dynamic
- * (sample linked) depending on the implementation of the selector.
- * </p>
- * 
- * <p>
- * <b>About the groupData :</b><br>
- * The grapher build an aggregator for each seriesData/key pair using an
- * external factory. All groupData from a series do the same aggregate
- * calculation.
- * <p>
- * 
- * <p>
- * <b>About the keys (x-axis coordinates) :</b><br>
- * Keys are defined by the keysSelector for each seriesData, so the keys can be
- * different depending on the seriesData
- * <p>
- * 
- * <p>
- * <b>About the values (y-axis coordinates) :</b><br>
- * Values are defined by the result aggregate produced by each aggregator.
- * During consumption, values to add to the groupData are defined by the
- * valueSelector.
- * </p>
- *
- * @since 2.14
- */
-public abstract class AbstractGraphConsumer extends AbstractSampleConsumer {
-
-    protected static final String DEFAULT_GROUP = "Generic group";
-
-    public static final String RESULT_MIN_X = "minX";
-    public static final String RESULT_MAX_X = "maxX";
-    public static final String RESULT_MIN_Y = "minY";
-    public static final String RESULT_MAX_Y = "maxY";
-    public static final String RESULT_SUPPORTS_CONTROLLERS_DISCRIMINATION = "supportsControllersDiscrimination";
-
-    public static final String RESULT_SERIES = "series";
-    public static final String RESULT_SERIES_NAME = "label";
-    public static final String RESULT_SERIES_DATA = "data";
-    public static final String RESULT_SERIES_IS_CONTROLLER = "isController";
-    public static final String RESULT_SERIES_IS_OVERALL = "isOverall";
-
-    /** The Constant DEFAULT_OVERALL_SERIES_NAME. */
-    public static final String DEFAULT_OVERALL_SERIES_FORMAT = "Overall %s";
-
-    /** The Constant DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT. */
-    public static final String DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT = "%s-Aggregated";
-
-    /** The map used to store group information. */
-    private final HashMap<String, GroupInfo> groupInfos;
-
-    /** The keys selector. */
-    private final GraphKeysSelector keysSelector;
-
-    /** The overall seriesData name. */
-    private String overallSeriesFormat = DEFAULT_OVERALL_SERIES_FORMAT;
-
-    /** The aggregated keys seriesData format. */
-    private String aggregatedKeysSeriesFormat = DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT;
-
-    /** reverts keys and values in the result. */
-    private boolean revertsKeysAndValues;
-
-    /** Renders percentiles in the results. */
-    private boolean renderPercentiles;
-
-    /**
-     * Gets the group information.
-     *
-     * @return the group information
-     */
-    protected final HashMap<String, GroupInfo> getGroupInfos() {
-        return groupInfos;
-    }
-
-    /**
-     * Reverts keys and values.
-     *
-     * @return the revertKeysAndValues
-     */
-    protected final boolean revertsKeysAndValues() {
-        return revertsKeysAndValues;
-    }
-
-    /**
-     * Reverts keys and values.
-     *
-     * @param revertsKeysAndValues
-     *            the reverts keys and values
-     */
-    protected final void setRevertKeysAndValues(boolean revertsKeysAndValues) {
-        this.revertsKeysAndValues = revertsKeysAndValues;
-    }
-
-    /**
-     * Indicates if the graph renders percentiles.
-     *
-     * @return true if percentiles are rendered; false otherwise
-     */
-    public final boolean rendersPercentiles() {
-        return renderPercentiles;
-    }
-
-    /**
-     * Enables or disables the percentiles render.
-     *
-     * @param renderPercentiles
-     *            the render mode to set
-     */
-    public final void setRenderPercentiles(boolean renderPercentiles) {
-        this.renderPercentiles = renderPercentiles;
-    }
-
-    /**
-     * Gets the keys selector.
-     *
-     * @return the keys selector
-     */
-    protected final GraphKeysSelector getKeysSelector() {
-        return keysSelector;
-    }
-
-    /**
-     * Gets the format of the "overall" seriesData name.
-     *
-     * @return the format of the "overall" seriesData name
-     */
-    public final String getOverallSeriesFormat() {
-        return overallSeriesFormat;
-    }
-
-    /**
-     * Sets the format of the "overall" seriesData name.
-     *
-     * @param overallSeriesFormat
-     *            the name of "overall" seriesData to set
-     */
-    public final void setOverallSeriesFormat(String overallSeriesFormat) {
-        this.overallSeriesFormat = overallSeriesFormat;
-    }
-
-    /**
-     * Gets the format for the name of aggregated keys seriesData.
-     *
-     * @return the format for the name of aggregated keys seriesData
-     */
-    public final String getAggregatedKeysSeriesFormat() {
-        return aggregatedKeysSeriesFormat;
-    }
-
-    /**
-     * Sets the format for the name of aggregated keys seriesData.
-     *
-     * @param aggregatedKeysSeriesFormat
-     *            the format for the name of aggregated keys seriesData to set
-     */
-    public final void setAggregatedKeysSeriesFormat(
-            String aggregatedKeysSeriesFormat) {
-        this.aggregatedKeysSeriesFormat = aggregatedKeysSeriesFormat;
-    }
-
-    /**
-     * Instantiates a new abstract graph consumer.
-     */
-    protected AbstractGraphConsumer() {
-        keysSelector = createKeysSelector();
-        groupInfos = new HashMap<>(createGroupInfos());
-    }
-
-    protected abstract GraphKeysSelector createKeysSelector();
-
-    protected abstract Map<String, GroupInfo> createGroupInfos();
-
-    private void setMinResult(MapResultData result, String name, Double value) {
-        ValueResultData valueResult = (ValueResultData) result.getResult(name);
-        valueResult.setValue(Math.min((Double) valueResult.getValue(), value));
-    }
-
-    private void setMaxResult(MapResultData result, String name, Double value) {
-        ValueResultData valueResult = (ValueResultData) result.getResult(name);
-        valueResult.setValue(Math.max((Double) valueResult.getValue(), value));
-    }
-
-    /**
-     * Adds a value map build from specified parameters to the result map.
-     *
-     * @param seriesData
-     *            the seriesData
-     * @param map
-     *            the groupData map
-     */
-    private void addKeyData(MapResultData result, String group, String series,
-            SeriesData seriesData, boolean aggregated) {
-
-        // Add to the result map
-        ListResultData seriesList = (ListResultData) result
-                .getResult(RESULT_SERIES);
-
-        // Looks for series result using its name
-        MapResultData seriesResult = null;
-        int index = 0;
-        int size = seriesList.getSize();
-        while (seriesResult == null && index < size) {
-            MapResultData currSeries = (MapResultData) seriesList.get(index);
-            String name = String.valueOf(((ValueResultData) currSeries
-                    .getResult(RESULT_SERIES_NAME)).getValue());
-            if (Objects.equals(name, series)) {
-                seriesResult = currSeries;
-            }
-            index++;
-        }
-
-        // Create series result if not found
-        if (seriesResult == null) {
-            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());
-            seriesList.addResult(seriesResult);
-        }
-
-        ListResultData dataResult = (ListResultData) seriesResult
-                .getResult(RESULT_SERIES_DATA);
-
-        // Populate it with data from groupData
-        Map<Double, Aggregator> aggInfo;
-        if (aggregated == false) {
-            aggInfo = seriesData.getAggregatorInfo();
-        } else {
-            series = String.format(aggregatedKeysSeriesFormat, series);
-            aggInfo = new HashMap<>();
-            aggInfo.put(seriesData.getKeysAggregator().getResult(),
-                    seriesData.getValuesAggregator());
-        }
-        if (renderPercentiles == false) {
-            for (Map.Entry<Double, Aggregator> entry : aggInfo.entrySet()) {
-                // Init key and value depending on revertsKeysAndValues property
-                Double key = entry.getKey();
-                Double value = entry.getValue().getResult();
-
-                // Create result storage for coordinates
-                ListResultData coordResult = new ListResultData();
-
-                if (revertsKeysAndValues == false) {
-                    key = entry.getKey();
-                    value = entry.getValue().getResult();
-                } else {
-                    key = entry.getValue().getResult();
-                    value = entry.getKey();
-                }
-                coordResult.addResult(new ValueResultData(key));
-                coordResult.addResult(new ValueResultData(value));
-                dataResult.addResult(coordResult);
-                setMinResult(result, RESULT_MIN_X, key);
-                setMaxResult(result, RESULT_MAX_X, key);
-                setMinResult(result, RESULT_MIN_Y, value);
-                setMaxResult(result, RESULT_MAX_Y, value);
-            }
-        } else {
-            long count = seriesData.getCount();
-            int rank = 0;
-            double percent = 0;
-            TreeMap<Double, Aggregator> sortedInfo = new TreeMap<>(aggInfo);
-            if (revertsKeysAndValues == false) {
-                for (Map.Entry<Double, Aggregator> entry : sortedInfo
-                        .entrySet()) {
-                    double value = entry.getKey();
-                    percent += (double) 100 * entry.getValue().getCount()
-                            / count;
-                    double percentile = (double) rank / 10;
-                    while (percentile < percent) {
-                        ListResultData coordResult = new ListResultData();
-                        coordResult.addResult(new ValueResultData(percentile));
-                        coordResult.addResult(new ValueResultData(value));
-                        dataResult.addResult(coordResult);
-                        percentile = (double) ++rank / 10;
-                    }
-                    setMinResult(result, RESULT_MIN_Y, value);
-                    setMaxResult(result, RESULT_MAX_Y, value);
-                }
-                setMinResult(result, RESULT_MIN_X, 0d);
-                setMaxResult(result, RESULT_MAX_X, 100d);
-            } else {
-                for (Map.Entry<Double, Aggregator> entry : sortedInfo
-                        .entrySet()) {
-                    double value = entry.getKey();
-                    percent += (double) 100 * entry.getValue().getCount()
-                            / count;
-                    double percentile = (double) rank / 10;
-                    while (percentile < percent) {
-                        ListResultData coordResult = new ListResultData();
-                        coordResult.addResult(new ValueResultData(value));
-                        coordResult.addResult(new ValueResultData(percentile));
-                        dataResult.addResult(coordResult);
-                        percentile = (double) ++rank / 10;
-                    }
-                    setMinResult(result, RESULT_MIN_X, value);
-                    setMaxResult(result, RESULT_MAX_X, value);
-                }
-                setMinResult(result, RESULT_MIN_Y, 0d);
-                setMaxResult(result, RESULT_MAX_Y, 100d);
-            }
-        }
-    }
-
-    /**
-     * Aggregate a value to the aggregator defined by the specified parameters.
-     *
-     * @param groupData
-     *            the map
-     * @param key
-     *            the key
-     * @param value
-     *            the value
-     */
-    private void aggregateValue(AggregatorFactory factory, SeriesData data,
-            double key, double value) {
-        Map<Double, Aggregator> aggInfo = data.getAggregatorInfo();
-
-        // Get or create aggregator
-        Aggregator aggregator = aggInfo.get(key);
-        if (aggregator == null) {
-            aggregator = factory.createValueAggregator();
-            aggInfo.put(key, aggregator);
-        }
-
-        // Add the value to the aggregator
-        aggregator.addValue(value);
-
-        // Increment the count of sample for this series
-        data.incrementCount();
-
-        // Aggregate keys if needed (if aggregated keys series is set)
-        Aggregator keysAgg = data.getKeysAggregator();
-        if (keysAgg != null) {
-            keysAgg.addValue(key);
-        }
-
-        // Aggregate values if needed (if aggregated keys series is set)
-        Aggregator valuesAgg = data.getValuesAggregator();
-        if (valuesAgg != null) {
-            valuesAgg.addValue(value);
-        }
-    }
-
-    private MapResultData createResult() {
-        MapResultData result = new MapResultData();
-        result.setResult(RESULT_MIN_X, new ValueResultData(Double.MAX_VALUE));
-        result.setResult(RESULT_MAX_X, new ValueResultData(Double.MIN_VALUE));
-        result.setResult(RESULT_MIN_Y, new ValueResultData(Double.MAX_VALUE));
-        result.setResult(RESULT_MAX_Y, new ValueResultData(Double.MIN_VALUE));
-        result.setResult(RESULT_SERIES, new ListResultData());
-
-        boolean supportsControllersDiscrimination = true;
-        Iterator<GroupInfo> it = groupInfos.values().iterator();
-        while (supportsControllersDiscrimination && it.hasNext()) {
-            supportsControllersDiscrimination &= it.next().getSeriesSelector()
-                    .allowsControllersDiscrimination();
-        }
-        result.setResult(RESULT_SUPPORTS_CONTROLLERS_DISCRIMINATION,
-                new ValueResultData(supportsControllersDiscrimination));
-
-        initializeExtraResults(result);
-        return result;
-    }
-
-    /**
-     * Inherited classes can add properties to the result
-     *
-     * @param parentResult
-     *            the parent result
-     */
-    protected abstract void initializeExtraResults(MapResultData parentResult);
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.csv.processor.SampleConsumer#startConsuming()
-     */
-    @Override
-    public void startConsuming() {
-
-        // Broadcast metadata to consumes for each channel
-        int channelCount = getConsumedChannelCount();
-        for (int i = 0; i < channelCount; i++) {
-            super.setProducedMetadata(getConsumedMetadata(i), i);
-        }
-
-        super.startProducing();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.csv.processor.SampleConsumer#consume(org.apache
-     * .jmeter.report.csv.core.Sample, int)
-     */
-    @Override
-    public void consume(Sample sample, int channel) {
-
-        // Get key from sample
-        Double key = keysSelector.select(sample);
-
-        // Build groupData maps
-        for (Map.Entry<String, GroupInfo> entryGroup : groupInfos.entrySet()) {
-            GroupInfo groupInfo = entryGroup.getValue();
-            GroupData groupData = groupInfo.getGroupData();
-            AggregatorFactory factory = groupInfo.getAggregatorFactory();
-            boolean overallSeries = groupInfo.enablesOverallSeries();
-            boolean aggregatedKeysSeries = groupInfo
-                    .enablesAggregatedKeysSeries();
-
-            for (String seriesName : groupInfo.getSeriesSelector().select(
-                    sample)) {
-                Map<String, SeriesData> seriesInfo = groupData.getSeriesInfo();
-                SeriesData seriesData = seriesInfo.get(seriesName);
-                if (seriesData == null) {
-                    seriesData = new SeriesData(factory, aggregatedKeysSeries,
-                            groupInfo.getSeriesSelector()
-                                    .allowsControllersDiscrimination() ? sample
-                                    .isController() : false, false);
-                    seriesInfo.put(seriesName, seriesData);
-                }
-
-                // Get the value to aggregate and dispatch it to the groupData
-                double value = groupInfo.getValueSelector().select(seriesName,
-                        sample);
-
-                aggregateValue(factory, seriesData, key, value);
-                if (overallSeries == true) {
-                    SeriesData overallData = groupData.getOverallSeries();
-                    aggregateValue(factory, overallData, key, value);
-                }
-
-            }
-        }
-
-        super.produce(sample, channel);
-    }
-
-    /*
-     * (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 == true) {
-                    addKeyData(result, groupName, seriesName, seriesData, true);
-                }
-            }
-
-            // Add overall values if needed
-            if (overallSeries == true) {
-                SeriesData overallData = groupData.getOverallSeries();
-                String overallSeriesName = String.format(overallSeriesFormat,
-                        groupName);
-                addKeyData(result, groupName, overallSeriesName, overallData,
-                        false);
-                if (aggregatedKeysSeries == true) {
-                    addKeyData(result, groupName, overallSeriesName,
-                            overallData, true);
-                }
-            }
-        }
-
-        // Store the result
-        setDataToContext(getName(), result);
-
-        for (GroupInfo groupInfo : groupInfos.values()) {
-            groupInfo.getGroupData().clear();
-        }
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Objects;
+import java.util.TreeMap;
+
+import org.apache.jmeter.report.core.Sample;
+import org.apache.jmeter.report.processor.AbstractSampleConsumer;
+import org.apache.jmeter.report.processor.Aggregator;
+import org.apache.jmeter.report.processor.AggregatorFactory;
+import org.apache.jmeter.report.processor.ListResultData;
+import org.apache.jmeter.report.processor.MapResultData;
+import org.apache.jmeter.report.processor.ValueResultData;
+
+/**
+ * <p>
+ * The class AbstractGraphConsumer provides a consumer that build a sorted map
+ * from samples. It uses a projection to define the key (x-axis coordinate) and
+ * an aggregator to define the value (y-axis coordinate).
+ * </p>
+ * 
+ * <p>
+ * <b>About the seriesData :</b><br>
+ * Series are defined by the seriesSelector, so they can be static or dynamic
+ * (sample linked) depending on the implementation of the selector.
+ * </p>
+ * 
+ * <p>
+ * <b>About the groupData :</b><br>
+ * The grapher build an aggregator for each seriesData/key pair using an
+ * external factory. All groupData from a series do the same aggregate
+ * calculation.
+ * <p>
+ * 
+ * <p>
+ * <b>About the keys (x-axis coordinates) :</b><br>
+ * Keys are defined by the keysSelector for each seriesData, so the keys can be
+ * different depending on the seriesData
+ * <p>
+ * 
+ * <p>
+ * <b>About the values (y-axis coordinates) :</b><br>
+ * Values are defined by the result aggregate produced by each aggregator.
+ * During consumption, values to add to the groupData are defined by the
+ * valueSelector.
+ * </p>
+ *
+ * @since 2.14
+ */
+public abstract class AbstractGraphConsumer extends AbstractSampleConsumer {
+
+    protected static final String DEFAULT_GROUP = "Generic group";
+
+    public static final String RESULT_MIN_X = "minX";
+    public static final String RESULT_MAX_X = "maxX";
+    public static final String RESULT_MIN_Y = "minY";
+    public static final String RESULT_MAX_Y = "maxY";
+    public static final String RESULT_SUPPORTS_CONTROLLERS_DISCRIMINATION = "supportsControllersDiscrimination";
+
+    public static final String RESULT_SERIES = "series";
+    public static final String RESULT_SERIES_NAME = "label";
+    public static final String RESULT_SERIES_DATA = "data";
+    public static final String RESULT_SERIES_IS_CONTROLLER = "isController";
+    public static final String RESULT_SERIES_IS_OVERALL = "isOverall";
+
+    /** The Constant DEFAULT_OVERALL_SERIES_NAME. */
+    public static final String DEFAULT_OVERALL_SERIES_FORMAT = "Overall %s";
+
+    /** The Constant DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT. */
+    public static final String DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT = "%s-Aggregated";
+
+    /** The map used to store group information. */
+    private final HashMap<String, GroupInfo> groupInfos;
+
+    /** The keys selector. */
+    private final GraphKeysSelector keysSelector;
+
+    /** The overall seriesData name. */
+    private String overallSeriesFormat = DEFAULT_OVERALL_SERIES_FORMAT;
+
+    /** The aggregated keys seriesData format. */
+    private String aggregatedKeysSeriesFormat = DEFAULT_AGGREGATED_KEYS_SERIES_FORMAT;
+
+    /** reverts keys and values in the result. */
+    private boolean revertsKeysAndValues;
+
+    /** Renders percentiles in the results. */
+    private boolean renderPercentiles;
+
+    /**
+     * Gets the group information.
+     *
+     * @return the group information
+     */
+    protected final HashMap<String, GroupInfo> getGroupInfos() {
+        return groupInfos;
+    }
+
+    /**
+     * Reverts keys and values.
+     *
+     * @return the revertKeysAndValues
+     */
+    protected final boolean revertsKeysAndValues() {
+        return revertsKeysAndValues;
+    }
+
+    /**
+     * Reverts keys and values.
+     *
+     * @param revertsKeysAndValues
+     *            the reverts keys and values
+     */
+    protected final void setRevertKeysAndValues(boolean revertsKeysAndValues) {
+        this.revertsKeysAndValues = revertsKeysAndValues;
+    }
+
+    /**
+     * Indicates if the graph renders percentiles.
+     *
+     * @return true if percentiles are rendered; false otherwise
+     */
+    public final boolean rendersPercentiles() {
+        return renderPercentiles;
+    }
+
+    /**
+     * Enables or disables the percentiles render.
+     *
+     * @param renderPercentiles
+     *            the render mode to set
+     */
+    public final void setRenderPercentiles(boolean renderPercentiles) {
+        this.renderPercentiles = renderPercentiles;
+    }
+
+    /**
+     * Gets the keys selector.
+     *
+     * @return the keys selector
+     */
+    protected final GraphKeysSelector getKeysSelector() {
+        return keysSelector;
+    }
+
+    /**
+     * Gets the format of the "overall" seriesData name.
+     *
+     * @return the format of the "overall" seriesData name
+     */
+    public final String getOverallSeriesFormat() {
+        return overallSeriesFormat;
+    }
+
+    /**
+     * Sets the format of the "overall" seriesData name.
+     *
+     * @param overallSeriesFormat
+     *            the name of "overall" seriesData to set
+     */
+    public final void setOverallSeriesFormat(String overallSeriesFormat) {
+        this.overallSeriesFormat = overallSeriesFormat;
+    }
+
+    /**
+     * Gets the format for the name of aggregated keys seriesData.
+     *
+     * @return the format for the name of aggregated keys seriesData
+     */
+    public final String getAggregatedKeysSeriesFormat() {
+        return aggregatedKeysSeriesFormat;
+    }
+
+    /**
+     * Sets the format for the name of aggregated keys seriesData.
+     *
+     * @param aggregatedKeysSeriesFormat
+     *            the format for the name of aggregated keys seriesData to set
+     */
+    public final void setAggregatedKeysSeriesFormat(
+            String aggregatedKeysSeriesFormat) {
+        this.aggregatedKeysSeriesFormat = aggregatedKeysSeriesFormat;
+    }
+
+    /**
+     * Instantiates a new abstract graph consumer.
+     */
+    protected AbstractGraphConsumer() {
+        keysSelector = createKeysSelector();
+        groupInfos = new HashMap<>(createGroupInfos());
+    }
+
+    protected abstract GraphKeysSelector createKeysSelector();
+
+    protected abstract Map<String, GroupInfo> createGroupInfos();
+
+    private void setMinResult(MapResultData result, String name, Double value) {
+        ValueResultData valueResult = (ValueResultData) result.getResult(name);
+        valueResult.setValue(Math.min((Double) valueResult.getValue(), value));
+    }
+
+    private void setMaxResult(MapResultData result, String name, Double value) {
+        ValueResultData valueResult = (ValueResultData) result.getResult(name);
+        valueResult.setValue(Math.max((Double) valueResult.getValue(), value));
+    }
+
+    /**
+     * Adds a value map build from specified parameters to the result map.
+     *
+     * @param seriesData
+     *            the seriesData
+     * @param map
+     *            the groupData map
+     */
+    private void addKeyData(MapResultData result, String group, String series,
+            SeriesData seriesData, boolean aggregated) {
+
+        // Add to the result map
+        ListResultData seriesList = (ListResultData) result
+                .getResult(RESULT_SERIES);
+
+        // Looks for series result using its name
+        MapResultData seriesResult = null;
+        int index = 0;
+        int size = seriesList.getSize();
+        while (seriesResult == null && index < size) {
+            MapResultData currSeries = (MapResultData) seriesList.get(index);
+            String name = String.valueOf(((ValueResultData) currSeries
+                    .getResult(RESULT_SERIES_NAME)).getValue());
+            if (Objects.equals(name, series)) {
+                seriesResult = currSeries;
+            }
+            index++;
+        }
+
+        // Create series result if not found
+        if (seriesResult == null) {
+            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());
+            seriesList.addResult(seriesResult);
+        }
+
+        ListResultData dataResult = (ListResultData) seriesResult
+                .getResult(RESULT_SERIES_DATA);
+
+        // Populate it with data from groupData
+        Map<Double, Aggregator> aggInfo;
+        if (aggregated == false) {
+            aggInfo = seriesData.getAggregatorInfo();
+        } else {
+            series = String.format(aggregatedKeysSeriesFormat, series);
+            aggInfo = new HashMap<>();
+            aggInfo.put(seriesData.getKeysAggregator().getResult(),
+                    seriesData.getValuesAggregator());
+        }
+        if (renderPercentiles == false) {
+            for (Map.Entry<Double, Aggregator> entry : aggInfo.entrySet()) {
+                // Init key and value depending on revertsKeysAndValues property
+                Double key = entry.getKey();
+                Double value = entry.getValue().getResult();
+
+                // Create result storage for coordinates
+                ListResultData coordResult = new ListResultData();
+
+                if (revertsKeysAndValues == false) {
+                    key = entry.getKey();
+                    value = entry.getValue().getResult();
+                } else {
+                    key = entry.getValue().getResult();
+                    value = entry.getKey();
+                }
+                coordResult.addResult(new ValueResultData(key));
+                coordResult.addResult(new ValueResultData(value));
+                dataResult.addResult(coordResult);
+                setMinResult(result, RESULT_MIN_X, key);
+                setMaxResult(result, RESULT_MAX_X, key);
+                setMinResult(result, RESULT_MIN_Y, value);
+                setMaxResult(result, RESULT_MAX_Y, value);
+            }
+        } else {
+            long count = seriesData.getCount();
+            int rank = 0;
+            double percent = 0;
+            TreeMap<Double, Aggregator> sortedInfo = new TreeMap<>(aggInfo);
+            if (revertsKeysAndValues == false) {
+                for (Map.Entry<Double, Aggregator> entry : sortedInfo
+                        .entrySet()) {
+                    double value = entry.getKey();
+                    percent += (double) 100 * entry.getValue().getCount()
+                            / count;
+                    double percentile = (double) rank / 10;
+                    while (percentile < percent) {
+                        ListResultData coordResult = new ListResultData();
+                        coordResult.addResult(new ValueResultData(percentile));
+                        coordResult.addResult(new ValueResultData(value));
+                        dataResult.addResult(coordResult);
+                        percentile = (double) ++rank / 10;
+                    }
+                    setMinResult(result, RESULT_MIN_Y, value);
+                    setMaxResult(result, RESULT_MAX_Y, value);
+                }
+                setMinResult(result, RESULT_MIN_X, 0d);
+                setMaxResult(result, RESULT_MAX_X, 100d);
+            } else {
+                for (Map.Entry<Double, Aggregator> entry : sortedInfo
+                        .entrySet()) {
+                    double value = entry.getKey();
+                    percent += (double) 100 * entry.getValue().getCount()
+                            / count;
+                    double percentile = (double) rank / 10;
+                    while (percentile < percent) {
+                        ListResultData coordResult = new ListResultData();
+                        coordResult.addResult(new ValueResultData(value));
+                        coordResult.addResult(new ValueResultData(percentile));
+                        dataResult.addResult(coordResult);
+                        percentile = (double) ++rank / 10;
+                    }
+                    setMinResult(result, RESULT_MIN_X, value);
+                    setMaxResult(result, RESULT_MAX_X, value);
+                }
+                setMinResult(result, RESULT_MIN_Y, 0d);
+                setMaxResult(result, RESULT_MAX_Y, 100d);
+            }
+        }
+    }
+
+    /**
+     * Aggregate a value to the aggregator defined by the specified parameters.
+     *
+     * @param groupData
+     *            the map
+     * @param key
+     *            the key
+     * @param value
+     *            the value
+     */
+    private void aggregateValue(AggregatorFactory factory, SeriesData data,
+            double key, double value) {
+        Map<Double, Aggregator> aggInfo = data.getAggregatorInfo();
+
+        // Get or create aggregator
+        Aggregator aggregator = aggInfo.get(key);
+        if (aggregator == null) {
+            aggregator = factory.createValueAggregator();
+            aggInfo.put(key, aggregator);
+        }
+
+        // Add the value to the aggregator
+        aggregator.addValue(value);
+
+        // Increment the count of sample for this series
+        data.incrementCount();
+
+        // Aggregate keys if needed (if aggregated keys series is set)
+        Aggregator keysAgg = data.getKeysAggregator();
+        if (keysAgg != null) {
+            keysAgg.addValue(key);
+        }
+
+        // Aggregate values if needed (if aggregated keys series is set)
+        Aggregator valuesAgg = data.getValuesAggregator();
+        if (valuesAgg != null) {
+            valuesAgg.addValue(value);
+        }
+    }
+
+    private MapResultData createResult() {
+        MapResultData result = new MapResultData();
+        result.setResult(RESULT_MIN_X, new ValueResultData(Double.MAX_VALUE));
+        result.setResult(RESULT_MAX_X, new ValueResultData(Double.MIN_VALUE));
+        result.setResult(RESULT_MIN_Y, new ValueResultData(Double.MAX_VALUE));
+        result.setResult(RESULT_MAX_Y, new ValueResultData(Double.MIN_VALUE));
+        result.setResult(RESULT_SERIES, new ListResultData());
+
+        boolean supportsControllersDiscrimination = true;
+        Iterator<GroupInfo> it = groupInfos.values().iterator();
+        while (supportsControllersDiscrimination && it.hasNext()) {
+            supportsControllersDiscrimination &= it.next().getSeriesSelector()
+                    .allowsControllersDiscrimination();
+        }
+        result.setResult(RESULT_SUPPORTS_CONTROLLERS_DISCRIMINATION,
+                new ValueResultData(supportsControllersDiscrimination));
+
+        initializeExtraResults(result);
+        return result;
+    }
+
+    /**
+     * Inherited classes can add properties to the result
+     *
+     * @param parentResult
+     *            the parent result
+     */
+    protected abstract void initializeExtraResults(MapResultData parentResult);
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.csv.processor.SampleConsumer#startConsuming()
+     */
+    @Override
+    public void startConsuming() {
+
+        // Broadcast metadata to consumes for each channel
+        int channelCount = getConsumedChannelCount();
+        for (int i = 0; i < channelCount; i++) {
+            super.setProducedMetadata(getConsumedMetadata(i), i);
+        }
+
+        super.startProducing();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.csv.processor.SampleConsumer#consume(org.apache
+     * .jmeter.report.csv.core.Sample, int)
+     */
+    @Override
+    public void consume(Sample sample, int channel) {
+
+        // Get key from sample
+        Double key = keysSelector.select(sample);
+
+        // Build groupData maps
+        for (Map.Entry<String, GroupInfo> entryGroup : groupInfos.entrySet()) {
+            GroupInfo groupInfo = entryGroup.getValue();
+            GroupData groupData = groupInfo.getGroupData();
+            AggregatorFactory factory = groupInfo.getAggregatorFactory();
+            boolean overallSeries = groupInfo.enablesOverallSeries();
+            boolean aggregatedKeysSeries = groupInfo
+                    .enablesAggregatedKeysSeries();
+
+            for (String seriesName : groupInfo.getSeriesSelector().select(
+                    sample)) {
+                Map<String, SeriesData> seriesInfo = groupData.getSeriesInfo();
+                SeriesData seriesData = seriesInfo.get(seriesName);
+                if (seriesData == null) {
+                    seriesData = new SeriesData(factory, aggregatedKeysSeries,
+                            groupInfo.getSeriesSelector()
+                                    .allowsControllersDiscrimination() ? sample
+                                    .isController() : false, false);
+                    seriesInfo.put(seriesName, seriesData);
+                }
+
+                // Get the value to aggregate and dispatch it to the groupData
+                double value = groupInfo.getValueSelector().select(seriesName,
+                        sample);
+
+                aggregateValue(factory, seriesData, key, value);
+                if (overallSeries == true) {
+                    SeriesData overallData = groupData.getOverallSeries();
+                    aggregateValue(factory, overallData, key, value);
+                }
+
+            }
+        }
+
+        super.produce(sample, channel);
+    }
+
+    /*
+     * (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 == true) {
+                    addKeyData(result, groupName, seriesName, seriesData, true);
+                }
+            }
+
+            // Add overall values if needed
+            if (overallSeries == true) {
+                SeriesData overallData = groupData.getOverallSeries();
+                String overallSeriesName = String.format(overallSeriesFormat,
+                        groupName);
+                addKeyData(result, groupName, overallSeriesName, overallData,
+                        false);
+                if (aggregatedKeysSeries == true) {
+                    addKeyData(result, groupName, overallSeriesName,
+                            overallData, true);
+                }
+            }
+        }
+
+        // Store the result
+        setDataToContext(getName(), result);
+
+        for (GroupInfo groupInfo : groupInfos.values()) {
+            groupInfo.getGroupData().clear();
+        }
+    }
+
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java Thu Dec 10 19:10:06 2015
@@ -1,108 +1,108 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-import java.util.Map;
-
-import org.apache.jmeter.report.processor.MapResultData;
-import org.apache.jmeter.report.processor.ValueResultData;
-
-/**
- * The class AbstractOverTimeGraphConsumer provides a base class for over time
- * graphs.
- *
- * @since 2.14
- */
-public abstract class AbstractOverTimeGraphConsumer extends
-        AbstractGraphConsumer {
-
-    public static final String RESULT_CTX_GRANULARITY = "granularity";
-
-    private long granularity;
-
-    /**
-     * Gets the granularity.
-     *
-     * @return the granularity
-     */
-    public long getGranularity() {
-        return granularity;
-    }
-
-    /**
-     * Sets the granularity.
-     *
-     * @param granularity
-     *            the granularity to set
-     */
-    public void setGranularity(long granularity) {
-        this.granularity = granularity;
-        ((TimeStampKeysSelector) getKeysSelector()).setGranularity(granularity);
-    }
-
-    /**
-     * Instantiates a new abstract over time graph consumer.
-     */
-    protected AbstractOverTimeGraphConsumer() {
-        setGranularity(1L);
-    }
-
-    /**
-     * Creates the time stamp keys selector.
-     *
-     * @return the time stamp keys selector
-     */
-    protected abstract TimeStampKeysSelector createTimeStampKeysSelector();
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jmeter.report.csv.processor.impl.AbstractGraphConsumer#
-     * createKeysSelector()
-     */
-    @Override
-    protected final GraphKeysSelector createKeysSelector() {
-        TimeStampKeysSelector keysSelector = createTimeStampKeysSelector();
-        keysSelector.setGranularity(granularity);
-        return keysSelector;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
-     * createGroupInfos()
-     */
-    @Override
-    protected Map<String, GroupInfo> createGroupInfos() {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
-     * initializeExtraResults(org.apache.jmeter.report.processor.MapResultData)
-     */
-    @Override
-    protected void initializeExtraResults(MapResultData parentResult) {
-        parentResult.setResult(RESULT_CTX_GRANULARITY, new ValueResultData(
-                granularity));
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+import java.util.Map;
+
+import org.apache.jmeter.report.processor.MapResultData;
+import org.apache.jmeter.report.processor.ValueResultData;
+
+/**
+ * The class AbstractOverTimeGraphConsumer provides a base class for over time
+ * graphs.
+ *
+ * @since 2.14
+ */
+public abstract class AbstractOverTimeGraphConsumer extends
+        AbstractGraphConsumer {
+
+    public static final String RESULT_CTX_GRANULARITY = "granularity";
+
+    private long granularity;
+
+    /**
+     * Gets the granularity.
+     *
+     * @return the granularity
+     */
+    public long getGranularity() {
+        return granularity;
+    }
+
+    /**
+     * Sets the granularity.
+     *
+     * @param granularity
+     *            the granularity to set
+     */
+    public void setGranularity(long granularity) {
+        this.granularity = granularity;
+        ((TimeStampKeysSelector) getKeysSelector()).setGranularity(granularity);
+    }
+
+    /**
+     * Instantiates a new abstract over time graph consumer.
+     */
+    protected AbstractOverTimeGraphConsumer() {
+        setGranularity(1L);
+    }
+
+    /**
+     * Creates the time stamp keys selector.
+     *
+     * @return the time stamp keys selector
+     */
+    protected abstract TimeStampKeysSelector createTimeStampKeysSelector();
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jmeter.report.csv.processor.impl.AbstractGraphConsumer#
+     * createKeysSelector()
+     */
+    @Override
+    protected final GraphKeysSelector createKeysSelector() {
+        TimeStampKeysSelector keysSelector = createTimeStampKeysSelector();
+        keysSelector.setGranularity(granularity);
+        return keysSelector;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
+     * createGroupInfos()
+     */
+    @Override
+    protected Map<String, GroupInfo> createGroupInfos() {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
+     * initializeExtraResults(org.apache.jmeter.report.processor.MapResultData)
+     */
+    @Override
+    protected void initializeExtraResults(MapResultData parentResult) {
+        parentResult.setResult(RESULT_CTX_GRANULARITY, new ValueResultData(
+                granularity));
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractOverTimeGraphConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractSeriesSelector.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractSeriesSelector.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractSeriesSelector.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractSeriesSelector.java Thu Dec 10 19:10:06 2015
@@ -1,59 +1,59 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-/**
- * The class AbstractSeriesSelector provide an abstract base class for
- * GraphSeriesSelector.
- *
- * @since 2.14
- */
-public abstract class AbstractSeriesSelector implements GraphSeriesSelector {
-
-    private final boolean allowsControllerDiscrimination;
-
-    /**
-     * Instantiates a new abstract series selector.
-     */
-    protected AbstractSeriesSelector() {
-        this(false);
-    }
-
-    /**
-     * Instantiates a new abstract series selector.
-     *
-     * @param allowsControllerDiscrimination
-     *            indicates whether this selector allows to discriminate
-     *            controllers
-     */
-    protected AbstractSeriesSelector(boolean allowsControllerDiscrimination) {
-        this.allowsControllerDiscrimination = allowsControllerDiscrimination;
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jmeter.report.processor.graph.GraphSeriesSelector#
-     * supportsControllersDiscrimination()
-     */
-    @Override
-    public final boolean allowsControllersDiscrimination() {
-        return allowsControllerDiscrimination;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+/**
+ * The class AbstractSeriesSelector provide an abstract base class for
+ * GraphSeriesSelector.
+ *
+ * @since 2.14
+ */
+public abstract class AbstractSeriesSelector implements GraphSeriesSelector {
+
+    private final boolean allowsControllerDiscrimination;
+
+    /**
+     * Instantiates a new abstract series selector.
+     */
+    protected AbstractSeriesSelector() {
+        this(false);
+    }
+
+    /**
+     * Instantiates a new abstract series selector.
+     *
+     * @param allowsControllerDiscrimination
+     *            indicates whether this selector allows to discriminate
+     *            controllers
+     */
+    protected AbstractSeriesSelector(boolean allowsControllerDiscrimination) {
+        this.allowsControllerDiscrimination = allowsControllerDiscrimination;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jmeter.report.processor.graph.GraphSeriesSelector#
+     * supportsControllersDiscrimination()
+     */
+    @Override
+    public final boolean allowsControllersDiscrimination() {
+        return allowsControllerDiscrimination;
+    }
+
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractSeriesSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java Thu Dec 10 19:10:06 2015
@@ -1,365 +1,365 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.jmeter.report.core.CsvSampleReader;
-import org.apache.jmeter.report.core.CsvSampleWriter;
-import org.apache.jmeter.report.core.Sample;
-import org.apache.jmeter.report.core.SampleBuilder;
-import org.apache.jmeter.report.core.SampleException;
-import org.apache.jmeter.report.core.SampleMetadata;
-import org.apache.jmeter.report.processor.AbstractSampleConsumer;
-import org.apache.jmeter.report.processor.MapResultData;
-import org.apache.jmeter.report.processor.ValueResultData;
-import org.apache.jorphan.logging.LoggingManager;
-import org.apache.log.Logger;
-
-/**
- * The class AbstractOverTimeGraphConsumer provides a base class for over time
- * graphs.
- *
- * @since 2.14
- */
-public abstract class AbstractVersusRequestsGraphConsumer extends
-        AbstractGraphConsumer {
-
-    public static final String RESULT_CTX_GRANULARITY = "granularity";
-    public static final String TIME_INTERVAL_LABEL = "Interval";
-
-    private long granularity;
-
-    /**
-     * The embedded time count consumer is used to buffer (disk storage) and tag
-     * samples with the number of samples in the same interval.
-     */
-    private final TimeCountConsumer embeddedConsumer;
-
-    /**
-     * Gets the granularity.
-     *
-     * @return the granularity
-     */
-    public long getGranularity() {
-        return granularity;
-    }
-
-    /**
-     * Sets the granularity.
-     *
-     * @param granularity
-     *            the granularity to set
-     */
-    public void setGranularity(long granularity) {
-        this.granularity = granularity;
-    }
-
-    /**
-     * Instantiates a new abstract over time graph consumer.
-     */
-    protected AbstractVersusRequestsGraphConsumer() {
-        embeddedConsumer = new TimeCountConsumer(this);
-        setGranularity(1L);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#startConsuming
-     * ()
-     */
-    @Override
-    public void startConsuming() {
-        embeddedConsumer.startConsuming();
-    }
-
-    private void startConsumingBase() {
-        super.startConsuming();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.processor.AbstractSampleConsumer#setConsumedMetadata
-     * (org.apache.jmeter.report.core.SampleMetadata, int)
-     */
-    @Override
-    public void setConsumedMetadata(SampleMetadata sampleMetadata, int channel) {
-        embeddedConsumer.setConsumedMetadata(sampleMetadata, channel);
-    }
-
-    private void setConsumedMetadataBase(SampleMetadata sampleMetadata,
-            int channel) {
-        super.setConsumedMetadata(sampleMetadata, channel);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#consume
-     * (org.apache.jmeter.report.core.Sample, int)
-     */
-    @Override
-    public void consume(Sample sample, int channel) {
-        embeddedConsumer.consume(sample, channel);
-    }
-
-    private void consumeBase(Sample sample, int channel) {
-        super.consume(sample, channel);
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#stopConsuming
-     * ()
-     */
-    @Override
-    public void stopConsuming() {
-        embeddedConsumer.stopConsuming();
-    }
-
-    public void stopConsumingBase() {
-        super.stopConsuming();
-    }
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
-     * initializeExtraResults(org.apache.jmeter.report.processor.MapResultData)
-     */
-    @Override
-    protected void initializeExtraResults(MapResultData parentResult) {
-        parentResult.setResult(RESULT_CTX_GRANULARITY, new ValueResultData(
-                granularity));
-    }
-
-    private static class TimeCountConsumer extends AbstractSampleConsumer {
-
-        private static final Logger log = LoggingManager.getLoggerForClass();
-
-        private class FileInfo {
-            private final File file;
-            private final CsvSampleWriter writer;
-
-            /**
-             * Instantiates a new file info.
-             *
-             * @param file
-             *            the file
-             * @param metadata
-             *            the metadata
-             */
-            public FileInfo(File file, SampleMetadata metadata) {
-                this.file = file;
-                this.writer = new CsvSampleWriter(file, metadata);
-            }
-
-            /**
-             * Gets the file.
-             *
-             * @return the file
-             */
-            public File getFile() {
-                return file;
-            }
-
-            /**
-             * Gets the sample writer.
-             *
-             * @return the sample writer
-             */
-            public CsvSampleWriter getWriter() {
-                return writer;
-            }
-        }
-
-        // Collection of sample builders for channels
-        private ArrayList<SampleBuilder> builders = new ArrayList<>();
-        private ArrayList<FileInfo> fileInfos = new ArrayList<>();
-        private HashMap<Long, Long> counts = new HashMap<>();
-        boolean createdWorkDir = false;
-        private final AbstractVersusRequestsGraphConsumer parent;
-
-        public TimeCountConsumer(AbstractVersusRequestsGraphConsumer parent) {
-            this.parent = parent;
-        }
-
-        private long getTimeInterval(Sample sample) {
-            long time = sample.getEndTime();
-            return time - (time % parent.getGranularity());
-        }
-
-        // Adds a new field in the sample metadata for each channel
-        private void initProducedMetadata() {
-            builders.clear();
-            int channelCount = getConsumedChannelCount();
-            for (int i = 0; i < channelCount; i++) {
-                // Get the metadata for the current channel
-                SampleMetadata consumedMetadata = getConsumedMetadata(i);
-
-                // Copy metadata to an array
-                int colCount = consumedMetadata.getColumnCount();
-                String[] names = new String[colCount + 1];
-                for (int j = 0; j < colCount; j++) {
-                    names[j] = consumedMetadata.getColumnName(j);
-                }
-
-                // Add the new field
-                names[colCount] = TIME_INTERVAL_LABEL;
-
-                // Build the produced metadata from the array
-                SampleMetadata producedMetadata = new SampleMetadata(
-                        consumedMetadata.getSeparator(), names);
-
-                // Add a sample builder for the current channel
-                builders.add(new SampleBuilder(producedMetadata));
-                parent.setConsumedMetadataBase(producedMetadata, i);
-            }
-        }
-
-        private Sample createIndexedSample(Sample sample, int channel,
-                double count) {
-            SampleBuilder builder = builders.get(channel);
-            SampleMetadata metadata = builder.getMetadata();
-            int colCount = metadata.getColumnCount();
-            for (int i = 0; i < colCount - 1; i++) {
-                builder.add(sample.getString(i));
-            }
-            builder.add(String.valueOf(count));
-            return builder.build();
-        }
-
-        @Override
-        public void startConsuming() {
-
-            // Handle the working directory
-            File workDir = parent.getWorkingDirectory();
-            createdWorkDir = false;
-            if (workDir.exists() == false) {
-                createdWorkDir = workDir.mkdir();
-                if (createdWorkDir == false) {
-                    String message = String.format(
-                            "Cannot create create working directory \"%s\"",
-                            workDir);
-                    log.error(message);
-                    throw new SampleException(message);
-                }
-            }
-
-            // Create a temporary file by channel to buffer samples
-            int channelsCount = getConsumedChannelCount();
-            for (int i = 0; i < channelsCount; i++) {
-                try {
-                    File tmpFile = File.createTempFile(parent.getName(), "-"
-                            + String.valueOf(i), workDir);
-                    tmpFile.deleteOnExit();
-                    fileInfos
-                            .add(new FileInfo(tmpFile, getConsumedMetadata(i)));
-                } catch (IOException ex) {
-                    String message = String.format(
-                            "Cannot create temporary file for channel #%d", i);
-                    log.error(message, ex);
-                    throw new SampleException(message, ex);
-                }
-            }
-
-            // Override produced metadata
-            initProducedMetadata();
-        }
-
-        /*
-         * (non-Javadoc)
-         * 
-         * @see
-         * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache.
-         * jmeter.report.core.Sample, int)
-         */
-        @Override
-        public void consume(Sample sample, int channel) {
-            // Count sample depending on time interval
-            long time = getTimeInterval(sample);
-            Long count = counts.get(time);
-            if (count != null) {
-                counts.put(time, count + 1);
-            } else {
-                counts.put(time, 1L);
-            }
-            fileInfos.get(channel).getWriter().write(sample);
-        }
-
-        @Override
-        public void stopConsuming() {
-
-            // Ask parent to start consumption
-            parent.startConsumingBase();
-
-            // Propagate tagged samples to parent
-            int channelsCount = getConsumedChannelCount();
-            for (int i = 0; i < channelsCount; i++) {
-                FileInfo fileInfo = fileInfos.get(i);
-
-                // Clean the writer
-                CsvSampleWriter writer = fileInfo.getWriter();
-                writer.close();
-
-                // Create a reader and use it to get the buffered samples
-                File file = fileInfo.getFile();
-                CsvSampleReader reader = new CsvSampleReader(file,
-                        getConsumedMetadata(i));
-                try {
-                    while (reader.hasNext()) {
-                        Sample sample = reader.readSample();
-                        // Ask parent to consume the altered sample
-                        parent.consumeBase(
-                                createIndexedSample(sample, i,
-                                        counts.get(getTimeInterval(sample))
-                                                % parent.getGranularity()), i);
-                    }
-                } finally {
-                    reader.close();
-                    file.delete();
-                }
-            }
-
-            if (createdWorkDir == true) {
-                File workingDir = parent.getWorkingDirectory();
-                try {
-                    FileUtils.deleteDirectory(workingDir);
-                } catch (IOException e) {
-                    log.warn(String.format(
-                            "Cannot delete created temporary directory \"%s\"",
-                            workingDir), e);
-                }
-            }
-
-            // Ask parent to stop consumption
-            parent.stopConsumingBase();
-        }
-    }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.jmeter.report.core.CsvSampleReader;
+import org.apache.jmeter.report.core.CsvSampleWriter;
+import org.apache.jmeter.report.core.Sample;
+import org.apache.jmeter.report.core.SampleBuilder;
+import org.apache.jmeter.report.core.SampleException;
+import org.apache.jmeter.report.core.SampleMetadata;
+import org.apache.jmeter.report.processor.AbstractSampleConsumer;
+import org.apache.jmeter.report.processor.MapResultData;
+import org.apache.jmeter.report.processor.ValueResultData;
+import org.apache.jorphan.logging.LoggingManager;
+import org.apache.log.Logger;
+
+/**
+ * The class AbstractOverTimeGraphConsumer provides a base class for over time
+ * graphs.
+ *
+ * @since 2.14
+ */
+public abstract class AbstractVersusRequestsGraphConsumer extends
+        AbstractGraphConsumer {
+
+    public static final String RESULT_CTX_GRANULARITY = "granularity";
+    public static final String TIME_INTERVAL_LABEL = "Interval";
+
+    private long granularity;
+
+    /**
+     * The embedded time count consumer is used to buffer (disk storage) and tag
+     * samples with the number of samples in the same interval.
+     */
+    private final TimeCountConsumer embeddedConsumer;
+
+    /**
+     * Gets the granularity.
+     *
+     * @return the granularity
+     */
+    public long getGranularity() {
+        return granularity;
+    }
+
+    /**
+     * Sets the granularity.
+     *
+     * @param granularity
+     *            the granularity to set
+     */
+    public void setGranularity(long granularity) {
+        this.granularity = granularity;
+    }
+
+    /**
+     * Instantiates a new abstract over time graph consumer.
+     */
+    protected AbstractVersusRequestsGraphConsumer() {
+        embeddedConsumer = new TimeCountConsumer(this);
+        setGranularity(1L);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#startConsuming
+     * ()
+     */
+    @Override
+    public void startConsuming() {
+        embeddedConsumer.startConsuming();
+    }
+
+    private void startConsumingBase() {
+        super.startConsuming();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.processor.AbstractSampleConsumer#setConsumedMetadata
+     * (org.apache.jmeter.report.core.SampleMetadata, int)
+     */
+    @Override
+    public void setConsumedMetadata(SampleMetadata sampleMetadata, int channel) {
+        embeddedConsumer.setConsumedMetadata(sampleMetadata, channel);
+    }
+
+    private void setConsumedMetadataBase(SampleMetadata sampleMetadata,
+            int channel) {
+        super.setConsumedMetadata(sampleMetadata, channel);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#consume
+     * (org.apache.jmeter.report.core.Sample, int)
+     */
+    @Override
+    public void consume(Sample sample, int channel) {
+        embeddedConsumer.consume(sample, channel);
+    }
+
+    private void consumeBase(Sample sample, int channel) {
+        super.consume(sample, channel);
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#stopConsuming
+     * ()
+     */
+    @Override
+    public void stopConsuming() {
+        embeddedConsumer.stopConsuming();
+    }
+
+    public void stopConsumingBase() {
+        super.stopConsuming();
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see org.apache.jmeter.report.processor.graph.AbstractGraphConsumer#
+     * initializeExtraResults(org.apache.jmeter.report.processor.MapResultData)
+     */
+    @Override
+    protected void initializeExtraResults(MapResultData parentResult) {
+        parentResult.setResult(RESULT_CTX_GRANULARITY, new ValueResultData(
+                granularity));
+    }
+
+    private static class TimeCountConsumer extends AbstractSampleConsumer {
+
+        private static final Logger log = LoggingManager.getLoggerForClass();
+
+        private class FileInfo {
+            private final File file;
+            private final CsvSampleWriter writer;
+
+            /**
+             * Instantiates a new file info.
+             *
+             * @param file
+             *            the file
+             * @param metadata
+             *            the metadata
+             */
+            public FileInfo(File file, SampleMetadata metadata) {
+                this.file = file;
+                this.writer = new CsvSampleWriter(file, metadata);
+            }
+
+            /**
+             * Gets the file.
+             *
+             * @return the file
+             */
+            public File getFile() {
+                return file;
+            }
+
+            /**
+             * Gets the sample writer.
+             *
+             * @return the sample writer
+             */
+            public CsvSampleWriter getWriter() {
+                return writer;
+            }
+        }
+
+        // Collection of sample builders for channels
+        private ArrayList<SampleBuilder> builders = new ArrayList<>();
+        private ArrayList<FileInfo> fileInfos = new ArrayList<>();
+        private HashMap<Long, Long> counts = new HashMap<>();
+        boolean createdWorkDir = false;
+        private final AbstractVersusRequestsGraphConsumer parent;
+
+        public TimeCountConsumer(AbstractVersusRequestsGraphConsumer parent) {
+            this.parent = parent;
+        }
+
+        private long getTimeInterval(Sample sample) {
+            long time = sample.getEndTime();
+            return time - (time % parent.getGranularity());
+        }
+
+        // Adds a new field in the sample metadata for each channel
+        private void initProducedMetadata() {
+            builders.clear();
+            int channelCount = getConsumedChannelCount();
+            for (int i = 0; i < channelCount; i++) {
+                // Get the metadata for the current channel
+                SampleMetadata consumedMetadata = getConsumedMetadata(i);
+
+                // Copy metadata to an array
+                int colCount = consumedMetadata.getColumnCount();
+                String[] names = new String[colCount + 1];
+                for (int j = 0; j < colCount; j++) {
+                    names[j] = consumedMetadata.getColumnName(j);
+                }
+
+                // Add the new field
+                names[colCount] = TIME_INTERVAL_LABEL;
+
+                // Build the produced metadata from the array
+                SampleMetadata producedMetadata = new SampleMetadata(
+                        consumedMetadata.getSeparator(), names);
+
+                // Add a sample builder for the current channel
+                builders.add(new SampleBuilder(producedMetadata));
+                parent.setConsumedMetadataBase(producedMetadata, i);
+            }
+        }
+
+        private Sample createIndexedSample(Sample sample, int channel,
+                double count) {
+            SampleBuilder builder = builders.get(channel);
+            SampleMetadata metadata = builder.getMetadata();
+            int colCount = metadata.getColumnCount();
+            for (int i = 0; i < colCount - 1; i++) {
+                builder.add(sample.getString(i));
+            }
+            builder.add(String.valueOf(count));
+            return builder.build();
+        }
+
+        @Override
+        public void startConsuming() {
+
+            // Handle the working directory
+            File workDir = parent.getWorkingDirectory();
+            createdWorkDir = false;
+            if (workDir.exists() == false) {
+                createdWorkDir = workDir.mkdir();
+                if (createdWorkDir == false) {
+                    String message = String.format(
+                            "Cannot create create working directory \"%s\"",
+                            workDir);
+                    log.error(message);
+                    throw new SampleException(message);
+                }
+            }
+
+            // Create a temporary file by channel to buffer samples
+            int channelsCount = getConsumedChannelCount();
+            for (int i = 0; i < channelsCount; i++) {
+                try {
+                    File tmpFile = File.createTempFile(parent.getName(), "-"
+                            + String.valueOf(i), workDir);
+                    tmpFile.deleteOnExit();
+                    fileInfos
+                            .add(new FileInfo(tmpFile, getConsumedMetadata(i)));
+                } catch (IOException ex) {
+                    String message = String.format(
+                            "Cannot create temporary file for channel #%d", i);
+                    log.error(message, ex);
+                    throw new SampleException(message, ex);
+                }
+            }
+
+            // Override produced metadata
+            initProducedMetadata();
+        }
+
+        /*
+         * (non-Javadoc)
+         * 
+         * @see
+         * org.apache.jmeter.report.processor.SampleConsumer#consume(org.apache.
+         * jmeter.report.core.Sample, int)
+         */
+        @Override
+        public void consume(Sample sample, int channel) {
+            // Count sample depending on time interval
+            long time = getTimeInterval(sample);
+            Long count = counts.get(time);
+            if (count != null) {
+                counts.put(time, count + 1);
+            } else {
+                counts.put(time, 1L);
+            }
+            fileInfos.get(channel).getWriter().write(sample);
+        }
+
+        @Override
+        public void stopConsuming() {
+
+            // Ask parent to start consumption
+            parent.startConsumingBase();
+
+            // Propagate tagged samples to parent
+            int channelsCount = getConsumedChannelCount();
+            for (int i = 0; i < channelsCount; i++) {
+                FileInfo fileInfo = fileInfos.get(i);
+
+                // Clean the writer
+                CsvSampleWriter writer = fileInfo.getWriter();
+                writer.close();
+
+                // Create a reader and use it to get the buffered samples
+                File file = fileInfo.getFile();
+                CsvSampleReader reader = new CsvSampleReader(file,
+                        getConsumedMetadata(i));
+                try {
+                    while (reader.hasNext()) {
+                        Sample sample = reader.readSample();
+                        // Ask parent to consume the altered sample
+                        parent.consumeBase(
+                                createIndexedSample(sample, i,
+                                        counts.get(getTimeInterval(sample))
+                                                % parent.getGranularity()), i);
+                    }
+                } finally {
+                    reader.close();
+                    file.delete();
+                }
+            }
+
+            if (createdWorkDir == true) {
+                File workingDir = parent.getWorkingDirectory();
+                try {
+                    FileUtils.deleteDirectory(workingDir);
+                } catch (IOException e) {
+                    log.warn(String.format(
+                            "Cannot delete created temporary directory \"%s\"",
+                            workingDir), e);
+                }
+            }
+
+            // Ask parent to stop consumption
+            parent.stopConsumingBase();
+        }
+    }
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractVersusRequestsGraphConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CodeSeriesSelector.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CodeSeriesSelector.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CodeSeriesSelector.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CodeSeriesSelector.java Thu Dec 10 19:10:06 2015
@@ -1,44 +1,44 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-import java.util.Arrays;
-
-import org.apache.jmeter.report.core.Sample;
-
-/**
- * The class CodeSeriesSelector provides a projection of a sample to its code
- * response.
- * 
- * @since 2.14
- */
-public class CodeSeriesSelector extends AbstractSeriesSelector {
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.csv.processor.SampleSelector#select(org.apache
-     * .jmeter.report.csv.core.Sample)
-     */
-    @Override
-    public Iterable<String> select(Sample sample) {
-        return Arrays.asList(sample.getResponseCode());
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+import java.util.Arrays;
+
+import org.apache.jmeter.report.core.Sample;
+
+/**
+ * The class CodeSeriesSelector provides a projection of a sample to its code
+ * response.
+ * 
+ * @since 2.14
+ */
+public class CodeSeriesSelector extends AbstractSeriesSelector {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.csv.processor.SampleSelector#select(org.apache
+     * .jmeter.report.csv.core.Sample)
+     */
+    @Override
+    public Iterable<String> select(Sample sample) {
+        return Arrays.asList(sample.getResponseCode());
+    }
+
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CodeSeriesSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CountValueSelector.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CountValueSelector.java?rev=1719185&r1=1719184&r2=1719185&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CountValueSelector.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CountValueSelector.java Thu Dec 10 19:10:06 2015
@@ -1,41 +1,41 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-package org.apache.jmeter.report.processor.graph;
-
-import org.apache.jmeter.report.core.Sample;
-
-/**
- * The class CountValueSelector provides a projection to count samples.
- *
- * @since 2.14
- */
-public class CountValueSelector implements GraphValueSelector {
-
-    /*
-     * (non-Javadoc)
-     * 
-     * @see
-     * org.apache.jmeter.report.csv.processor.GraphValueSelector#select(java
-     * .lang.String, java.lang.Object, org.apache.jmeter.report.csv.core.Sample)
-     */
-    @Override
-    public double select(String series, Sample sample) {
-        return 1;
-    }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.jmeter.report.processor.graph;
+
+import org.apache.jmeter.report.core.Sample;
+
+/**
+ * The class CountValueSelector provides a projection to count samples.
+ *
+ * @since 2.14
+ */
+public class CountValueSelector implements GraphValueSelector {
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see
+     * org.apache.jmeter.report.csv.processor.GraphValueSelector#select(java
+     * .lang.String, java.lang.Object, org.apache.jmeter.report.csv.core.Sample)
+     */
+    @Override
+    public double select(String series, Sample sample) {
+        return 1;
+    }
+
+}

Propchange: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/CountValueSelector.java
------------------------------------------------------------------------------
    svn:eol-style = native




Mime
View raw message