jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1659928 - in /jmeter/trunk: src/components/org/apache/jmeter/visualizers/ xdocs/
Date Sun, 15 Feb 2015 15:26:07 GMT
Author: pmouawad
Date: Sun Feb 15 15:26:07 2015
New Revision: 1659928

URL: http://svn.apache.org/r1659928
Log:
Bug 57514 - Aggregate Graph, Summary Report and Aggregate Report show wrong percentage reporting
in saved file
Bugzilla Id: 57514

Modified:
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
    jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java?rev=1659928&r1=1659927&r2=1659928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatGraphVisualizer.java Sun
Feb 15 15:26:07 2015
@@ -28,6 +28,8 @@ import java.awt.event.ActionListener;
 import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.text.DecimalFormat;
+import java.text.Format;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.List;
@@ -308,6 +310,23 @@ public class StatGraphVisualizer extends
                             String.class, String.class });
     }
 
+    // Column formats
+    static final Format[] FORMATS =
+        new Format[]{
+            null, // Label
+            null, // count
+            null, // Mean
+            null, // median
+            null, // 90%
+            null, // 95%
+            null, // 99%
+            null, // Min
+            null, // Max
+            new DecimalFormat("#0.00%"), // Error %age //$NON-NLS-1$
+            new DecimalFormat("#.0"),      // Throughput //$NON-NLS-1$
+            new DecimalFormat("#.0")    // pageSize   //$NON-NLS-1$
+        };
+    
     // Column renderers
     static final TableCellRenderer[] RENDERERS =
         new TableCellRenderer[]{
@@ -574,9 +593,10 @@ public class StatGraphVisualizer extends
      * ObjectTableModel, so the calling getDataVector doesn't
      * work as expected.
      * @param model {@link ObjectTableModel}
+     * @param formats Array of {@link Format} array can contain null formatters in this case
value is added as is
      * @return the data from the model
      */
-    public static List<List<Object>> getAllTableData(ObjectTableModel model)
{
+    public static List<List<Object>> getAllTableData(ObjectTableModel model,
Format[] formats) {
         List<List<Object>> data = new ArrayList<List<Object>>();
         if (model.getRowCount() > 0) {
             for (int rw=0; rw < model.getRowCount(); rw++) {
@@ -585,7 +605,11 @@ public class StatGraphVisualizer extends
                 data.add(column);
                 for (int idx=0; idx < cols; idx++) {
                     Object val = model.getValueAt(rw,idx);
-                    column.add(val);
+                    if(formats[idx] != null) {
+                        column.add(formats[idx].format(val));
+                    } else {
+                        column.add(val);
+                    }
                 }
             }
         }
@@ -615,7 +639,7 @@ public class StatGraphVisualizer extends
             FileWriter writer = null;
             try {
                 writer = new FileWriter(chooser.getSelectedFile()); // TODO Charset ?
-                CSVSaveService.saveCSVStats(getAllTableData(model),writer,saveHeaders.isSelected()
? getLabels(COLUMNS) : null);
+                CSVSaveService.saveCSVStats(getAllTableData(model, FORMATS),writer,saveHeaders.isSelected()
? getLabels(COLUMNS) : null);
             } catch (FileNotFoundException e) {
                 JMeterUtils.reportErrorToUser(e.getMessage(), "Error saving data");
             } catch (IOException e) {

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java?rev=1659928&r1=1659927&r2=1659928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/StatVisualizer.java Sun Feb
15 15:26:07 2015
@@ -213,7 +213,7 @@ public class StatVisualizer extends Abst
             FileWriter writer = null;
             try {
                 writer = new FileWriter(chooser.getSelectedFile()); // TODO Charset ?
-                CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model),writer,
+                CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model, StatGraphVisualizer.FORMATS),writer,
                         saveHeaders.isSelected() ? StatGraphVisualizer.getLabels(StatGraphVisualizer.COLUMNS)
: null);
             } catch (FileNotFoundException e) {
                 JMeterUtils.reportErrorToUser(e.getMessage(), "Error saving data");

Modified: jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java?rev=1659928&r1=1659927&r2=1659928&view=diff
==============================================================================
--- jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java (original)
+++ jmeter/trunk/src/components/org/apache/jmeter/visualizers/SummaryReport.java Sun Feb 15
15:26:07 2015
@@ -25,6 +25,8 @@ import java.awt.event.ActionListener;
 import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.text.DecimalFormat;
+import java.text.Format;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
@@ -114,11 +116,26 @@ public class SummaryReport extends Abstr
             null, // Mean
             null, // Min
             null, // Max
-            new NumberRenderer("#0.00"), // Std Dev.
-            new NumberRenderer("#0.00%"), // Error %age
-            new RateRenderer("#.0"),      // Throughput
-            new NumberRenderer("#0.00"),  // kB/sec
-            new NumberRenderer("#.0"),    // avg. pageSize
+            new NumberRenderer("#0.00"), // Std Dev. //$NON-NLS-1$
+            new NumberRenderer("#0.00%"), // Error %age //$NON-NLS-1$
+            new RateRenderer("#.0"),      // Throughput //$NON-NLS-1$
+            new NumberRenderer("#0.00"),  // kB/sec //$NON-NLS-1$
+            new NumberRenderer("#.0"),    // avg. pageSize //$NON-NLS-1$
+        };
+    
+    // Column formats
+    static final Format[] FORMATS =
+        new Format[]{
+            null, // Label
+            null, // count
+            null, // Mean
+            null, // Min
+            null, // Max
+            new DecimalFormat("#0.00"), // Std Dev. //$NON-NLS-1$
+            new DecimalFormat("#0.00%"), // Error %age //$NON-NLS-1$
+            new DecimalFormat("#.0"),      // Throughput //$NON-NLS-1$
+            new DecimalFormat("#0.00"),  // kB/sec //$NON-NLS-1$
+            new DecimalFormat("#.0"),    // avg. pageSize //$NON-NLS-1$
         };
 
     public SummaryReport() {
@@ -257,7 +274,7 @@ public class SummaryReport extends Abstr
             FileWriter writer = null;
             try {
                 writer = new FileWriter(chooser.getSelectedFile());
-                CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model),writer,

+                CSVSaveService.saveCSVStats(StatGraphVisualizer.getAllTableData(model, FORMATS),writer,

                         saveHeaders.isSelected() ? StatGraphVisualizer.getLabels(COLUMNS)
: null);
             } catch (FileNotFoundException e) {
                 JMeterUtils.reportErrorToUser(e.getMessage(), "Error saving data");

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1659928&r1=1659927&r2=1659928&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sun Feb 15 15:26:07 2015
@@ -161,6 +161,7 @@ See  <bugzilla>56357</bugzilla> for deta
 <li><bug>57346</bug>Summariser : The + (difference) reports show wrong
elapsed time and throughput</li>
 <li><bug>57449</bug>Distributed Testing: Stripped modes do not strip responses
from SubResults (affects load tests that use Download of embedded resources). Contributed
by Ubik Load Pack (support at ubikloadpack.com)</li>
 <li><bug>57562</bug>View Results Tree CSS/JQuery Tester : Nothing happens
when there is an error in syntax and an exception occurs in jmeter.log</li>
+<li><bug>57514</bug>Aggregate Graph, Summary Report and Aggregate Report
show wrong percentage reporting in saved file</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>



Mime
View raw message