Author: pmouawad
Date: Sat Apr 16 12:35:29 2016
New Revision: 1739449

URL: http://svn.apache.org/viewvc?rev=1739449&view=rev
Log:
Bug 59337 - JMeter Report Generator : "jmeter.reportgenerator.sample_filter" 
should be a regexp as "jmeter.reportgenerator.exporter.html.series_filter"
Bugzilla Id: 59337

Modified:
    jmeter/trunk/bin/jmeter.properties
    jmeter/trunk/bin/user.properties
    
jmeter/trunk/src/core/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java
    
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
    jmeter/trunk/xdocs/usermanual/generating-dashboard.xml

Modified: jmeter/trunk/bin/jmeter.properties
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/bin/jmeter.properties?rev=1739449&r1=1739448&r2=1739449&view=diff
==============================================================================
--- jmeter/trunk/bin/jmeter.properties (original)
+++ jmeter/trunk/bin/jmeter.properties Sat Apr 16 12:35:29 2016
@@ -1181,8 +1181,8 @@ classfinder.functions.notContain=.gui.
 # Sets the tolerance threshold for the APDEX calculation (in milliseconds).
 #jmeter.reportgenerator.apdex_tolerated_threshold=1500
 
-# Sets the filter for samples to keep for graphs and statistics generation.
-# A comma separated list of samples names, empty string means no filtering
+# Regular Expression which Indicates which samples to keep for graphs and 
statistics generation.
+# Empty value means no filtering
 #jmeter.reportgenerator.sample_filter=
 
 # Sets the temporary directory used by the generation processus if it needs 
file I/O operations.
@@ -1270,7 +1270,8 @@ jmeter.reportgenerator.exporter.html.cla
 # This will be overriden by the command line option -o 
 #jmeter.reportgenerator.exporter.html.property.output_dir=report-output
 
-# Indicates which graph series are filtered (regular expression)
+# Regular Expression which Indicates which graph series are filtered in display
+# Empty value means no filtering
 #jmeter.reportgenerator.exporter.html.series_filter=
 
 # Indicates whether series filter apply only on sample series

Modified: jmeter/trunk/bin/user.properties
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/bin/user.properties?rev=1739449&r1=1739448&r2=1739449&view=diff
==============================================================================
--- jmeter/trunk/bin/user.properties (original)
+++ jmeter/trunk/bin/user.properties Sat Apr 16 12:35:29 2016
@@ -84,7 +84,8 @@
 
#jmeter.reportgenerator.graph.responseTimeDistribution.property.set_granularity=500
 
 # Change this parameter if you want to keep only some samples.
-# A comma separated list of samples to keep is expected.
+# Regular Expression which Indicates which samples to keep for graphs and 
statistics generation.
+# Empty value means no filtering
 #jmeter.reportgenerator.sample_filter=
 
 # Change this parameter if you want to override the APDEX satisfaction 
threshold.

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java?rev=1739449&r1=1739448&r2=1739449&view=diff
==============================================================================
--- 
jmeter/trunk/src/core/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java
 (original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/report/config/ReportGeneratorConfiguration.java
 Sat Apr 16 12:35:29 2016
@@ -18,18 +18,17 @@
 package org.apache.jmeter.report.config;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.List;
 import java.util.Map;
-import java.util.Objects;
 import java.util.Properties;
+import java.util.regex.Pattern;
 
+import jodd.props.Props;
+
+import org.apache.commons.lang3.StringUtils;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.log.Logger;
 
-import jodd.props.Props;
-
 /**
  * The class ReportGeneratorConfiguration describes the configuration of the
  * report generator.
@@ -265,7 +264,7 @@ public class ReportGeneratorConfiguratio
     private File tempDirectory;
     private long apdexSatisfiedThreshold;
     private long apdexToleratedThreshold;
-    private List<String> filteredSamples = new ArrayList<>();
+    private Pattern filteredSamplesPattern;
     private Map<String, ExporterConfiguration> exportConfigurations = new 
HashMap<>();
     private Map<String, GraphConfiguration> graphConfigurations = new 
HashMap<>();
 
@@ -285,15 +284,7 @@ public class ReportGeneratorConfiguratio
      *            the new overall sample filter
      */
     public final void setSampleFilter(String sampleFilter) {
-        if (!Objects.equals(this.sampleFilter, sampleFilter)) {
-            this.sampleFilter = sampleFilter;
-            filteredSamples.clear();
-            if (sampleFilter != null) {
-                for (String item: sampleFilter.split(",")) {
-                    filteredSamples.add(item.trim());
-                }
-            }
-        }
+        this.sampleFilter = sampleFilter;
     }
 
     /**
@@ -354,15 +345,6 @@ public class ReportGeneratorConfiguratio
     }
 
     /**
-     * Gets the filtered samples.
-     *
-     * @return the filteredSamples
-     */
-    public final List<String> getFilteredSamples() {
-        return filteredSamples;
-    }
-
-    /**
      * Gets the export configurations.
      *
      * @return the export configurations
@@ -671,4 +653,17 @@ public class ReportGeneratorConfiguratio
     public void setReportTitle(String reportTitle) {
         this.reportTitle = reportTitle;
     }
+
+    /**
+     * @return the filteredSamplesPattern
+     */
+    public Pattern getFilteredSamplesPattern() {
+        if(StringUtils.isEmpty(sampleFilter)) {
+            return null;
+        }
+        if(filteredSamplesPattern == null) {
+            filteredSamplesPattern = Pattern.compile(sampleFilter);
+        }
+        return filteredSamplesPattern;
+    }
 }

Modified: 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java?rev=1739449&r1=1739448&r2=1739449&view=diff
==============================================================================
--- 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java 
(original)
+++ 
jmeter/trunk/src/core/org/apache/jmeter/report/dashboard/ReportGenerator.java 
Sat Apr 16 12:35:29 2016
@@ -392,12 +392,12 @@ public class ReportGenerator {
             @Override
             public boolean matches(Sample sample) {
                 // Get filtered samples from configuration
-                List<String> filteredSamples = configuration
-                        .getFilteredSamples();
-                // Sample is kept if none filter is set or if the filter
-                // contains its name
-                return filteredSamples.isEmpty()
-                        || filteredSamples.contains(sample.getName());
+                Pattern filteredSamplesPattern = configuration
+                        .getFilteredSamplesPattern();
+                // Sample is kept if no filter is set 
+                // or if its name matches the filter pattern
+                return filteredSamplesPattern == null 
+                        || 
filteredSamplesPattern.matcher(sample.getName()).matches();
             }
         });
         nameFilter.addSampleConsumer(createApdexSummaryConsumer());

Modified: jmeter/trunk/xdocs/usermanual/generating-dashboard.xml
URL: 
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/generating-dashboard.xml?rev=1739449&r1=1739448&r2=1739449&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/generating-dashboard.xml (original)
+++ jmeter/trunk/xdocs/usermanual/generating-dashboard.xml Sat Apr 16 12:35:29 
2016
@@ -114,8 +114,8 @@ jmeter.save.saveservice.timestamp_format
                             Sets the filter of samples to keep for generating
                             graphs and statistics. An empty value deactivates 
the
                             filtering.
-                            Format: comma separated list of
-                            sample names. Default: ""
+                            Format: Regular expression. 
+                            Default: ""
                         </property>
                         <property name="temp_dir" required="No">
                             Sets the temporary directory used by the generation


Reply via email to