jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1831023 - in /jmeter/trunk: bin/report-template/content/js/ src/core/org/apache/jmeter/report/processor/graph/ src/core/org/apache/jmeter/report/processor/graph/impl/ xdocs/
Date Sun, 06 May 2018 09:00:57 GMT
Author: pmouawad
Date: Sun May  6 09:00:57 2018
New Revision: 1831023

URL: http://svn.apache.org/viewvc?rev=1831023&view=rev
Log:
Bug 62333 - Report Dashboard - When 1 serie contains no value, the graph colors logic is wrong
Contributed by UbikLoadPack
Bugzilla Id: 62333

Modified:
    jmeter/trunk/bin/report-template/content/js/graph.js.fmkr
    jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/AbstractGraphConsumer.java
    jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/bin/report-template/content/js/graph.js.fmkr
URL: http://svn.apache.org/viewvc/jmeter/trunk/bin/report-template/content/js/graph.js.fmkr?rev=1831023&r1=1831022&r2=1831023&view=diff
==============================================================================
--- jmeter/trunk/bin/report-template/content/js/graph.js.fmkr (original)
+++ jmeter/trunk/bin/report-template/content/js/graph.js.fmkr Sun May  6 09:00:57 2018
@@ -396,8 +396,7 @@ var syntheticResponseTimeDistributionInf
                     content: function(label, xval, yval, flotItem){
                         return yval + " " + label;
                     }
-                },
-                colors: ["#9ACD32", "yellow", "orange", "#FF6347"]                
+                }
             };
         },
         createGraph: function() {

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=1831023&r1=1831022&r2=1831023&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
Sun May  6 09:00:57 2018
@@ -286,16 +286,7 @@ public abstract class AbstractGraphConsu
 
         // 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(
-                            Boolean.valueOf(seriesData.isControllersSeries())));
-            seriesResult.setResult(RESULT_SERIES_IS_OVERALL,
-                    new ValueResultData(
-                            Boolean.valueOf(seriesData.isOverallSeries())));
-            seriesResult.setResult(RESULT_SERIES_DATA, new ListResultData());
+            seriesResult = createSerieResult(series, seriesData);
             seriesList.addResult(seriesResult);
         }
 
@@ -386,6 +377,25 @@ public abstract class AbstractGraphConsu
     }
 
     /**
+     * @param serie String serie name
+     * @param seriesData 
+     * @return MapResultData metadata for serie
+     */
+    protected MapResultData createSerieResult(String serie, SeriesData seriesData) {
+        MapResultData seriesResult = new MapResultData();
+        seriesResult.setResult(RESULT_SERIES_NAME,
+                new ValueResultData(serie));
+        seriesResult.setResult(RESULT_SERIES_IS_CONTROLLER,
+                new ValueResultData(
+                        Boolean.valueOf(seriesData.isControllersSeries())));
+        seriesResult.setResult(RESULT_SERIES_IS_OVERALL,
+                new ValueResultData(
+                        Boolean.valueOf(seriesData.isOverallSeries())));
+        seriesResult.setResult(RESULT_SERIES_DATA, new ListResultData());
+        return seriesResult;
+    }
+
+    /**
      * Aggregate a value to the aggregator defined by the specified parameters.
      */
     private void aggregateValue(AggregatorFactory factory, SeriesData data,

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java?rev=1831023&r1=1831022&r2=1831023&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/processor/graph/impl/SyntheticResponseTimeDistributionGraphConsumer.java
Sun May  6 09:00:57 2018
@@ -32,6 +32,7 @@ import org.apache.jmeter.report.processo
 import org.apache.jmeter.report.processor.graph.CountValueSelector;
 import org.apache.jmeter.report.processor.graph.GraphKeysSelector;
 import org.apache.jmeter.report.processor.graph.GroupInfo;
+import org.apache.jmeter.report.processor.graph.SeriesData;
 import org.apache.jmeter.util.JMeterUtils;
 
 /**
@@ -46,6 +47,11 @@ public class SyntheticResponseTimeDistri
     private static final MessageFormat SATISFIED_LABEL = new MessageFormat(JMeterUtils.getResString("response_time_distribution_satisfied_label"));
     private static final MessageFormat TOLERATED_LABEL = new MessageFormat(JMeterUtils.getResString("response_time_distribution_tolerated_label"));
     private static final MessageFormat UNTOLERATED_LABEL = new MessageFormat(JMeterUtils.getResString("response_time_distribution_untolerated_label"));
+    private static final String SERIE_COLOR_PROPERTY = "color";
+    private static final String SATISFIED_COLOR = "#9ACD32";
+    private static final String TOLERATED_COLOR = "yellow";
+    private static final String UNTOLERATED_COLOR = "orange";
+    private static final String FAILED_COLOR = "#FF6347";
 
     private long satisfiedThreshold;
     private long toleratedThreshold;
@@ -116,19 +122,40 @@ public class SyntheticResponseTimeDistri
     @Override
     protected void initializeExtraResults(MapResultData parentResult) {
         ListResultData listResultData = new ListResultData();
-        String[] messages = new String[]{
+        String[] seriesLabels = new String[]{
                 SATISFIED_LABEL.format(new Object[] {Long.valueOf(getSatisfiedThreshold())}),
                 TOLERATED_LABEL.format(new Object[] {Long.valueOf(getSatisfiedThreshold()),
Long.valueOf(getToleratedThreshold())}),
                 UNTOLERATED_LABEL.format(new Object[] {Long.valueOf(getToleratedThreshold())}),
                 FAILED_LABEL
         };
-        for (int i = 0; i < messages.length; i++) {
+        String[] colors = new String[]{
+                SATISFIED_COLOR, TOLERATED_COLOR, UNTOLERATED_COLOR, FAILED_COLOR 
+        };
+        for (int i = 0; i < seriesLabels.length; i++) {
             ListResultData array = new ListResultData();
             array.addResult(new ValueResultData(Integer.valueOf(i)));
-            array.addResult(new ValueResultData(messages[i]));   
+            array.addResult(new ValueResultData(seriesLabels[i]));
             listResultData.addResult(array);
-        }        
+        }
         parentResult.setResult("ticks", listResultData);
+        initializeSeries(parentResult, seriesLabels, colors);
+    }
+
+    private void initializeSeries(MapResultData parentResult, String[] series, String[] colors)
{
+        ListResultData listResultData = (ListResultData) parentResult.getResult("series");
+        for (int i = 0; i < series.length; i++) {
+            listResultData.addResult(create(series[i], colors[i]));
+        }
+    }
+    
+    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;
     }
 
     /**

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1831023&r1=1831022&r2=1831023&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sun May  6 09:00:57 2018
@@ -206,6 +206,7 @@ this behaviour, set <code>httpclient.res
 
 <h3>Report / Dashboard</h3>
 <ul>
+    <li><bug>62333</bug>Report Dashboard - When 1 serie contains no value,
the graph colors logic is wrong. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
 </ul>
 
 <h3>Documentation</h3>



Mime
View raw message