jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1819161 - in /jmeter/trunk: src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy xdocs/changes.xml
Date Sat, 23 Dec 2017 15:31:19 GMT
Author: pmouawad
Date: Sat Dec 23 15:31:19 2017
New Revision: 1819161

URL: http://svn.apache.org/viewvc?rev=1819161&view=rev
Log:
Bug 61900 - Report Generator : Report generation fails if separator is a regex reserved char
like '|'
Bugzilla Id: 61900

Added:
    jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy
Modified:
    jmeter/trunk/src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java?rev=1819161&r1=1819160&r2=1819161&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/report/core/SampleMetaDataParser.java Sat Dec
23 15:31:19 2017
@@ -17,6 +17,8 @@
  */
 package org.apache.jmeter.report.core;
 
+import java.util.regex.Pattern;
+
 /**
  * Simple parser to get a {@link SampleMetadata} instance<br>
  * 
@@ -31,8 +33,7 @@ public class SampleMetaDataParser {
     }
 
     public SampleMetadata parse(String headRow) {
-        String[] cols = headRow.split(Character.toString(separator));
-        SampleMetadata out = new SampleMetadata(separator, cols);
-        return out;
+        String[] cols = headRow.split(Pattern.quote(Character.toString(separator)));
+        return new SampleMetadata(separator, cols);
     }
 }

Added: jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy?rev=1819161&view=auto
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy (added)
+++ jmeter/trunk/test/src/org/apache/jmeter/report/core/SampleMetadataParserSpec.groovy Sat
Dec 23 15:31:19 2017
@@ -0,0 +1,40 @@
+/*
+ * 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.core;
+
+import org.apache.jmeter.junit.spock.JMeterSpec;
+import org.apache.jmeter.report.core.SampleMetaDataParser;
+
+class SampleMetadataParserSpec extends JMeterSpec {
+
+    
+    def "Parse headers (#headers) using separator (#separator) and get (#expectedNumberOfColumns)"()
{
+        given:
+            def dataParser = new SampleMetaDataParser(separator);
+        when:
+            def metadata = dataParser.parse(headers);
+        then:
+            metadata.columns.size() == expectedNumberOfColumns;
+        where:
+            separator   | headers   	| expectedNumberOfColumns
+            ";" 		| "a;b;c;d;e"  	| 5
+            // This should fail
+            "|"  		| "a|b|c|d|e" 	| 6
+    }
+
+}

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1819161&r1=1819160&r2=1819161&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Dec 23 15:31:19 2017
@@ -261,6 +261,7 @@ Summary
 <h3>Report / Dashboard</h3>
 <ul>
     <li><bug>61807</bug>Web Report : fix error in <code>getTop5ErrorMetrics</code>.
Contributed by Graham Russell (graham at ham1.co.uk)</li>
+    <li><bug>61900</bug>Report Generator : Report generation fails if separator
is a regex reserved char like <code>|</code></li>
 </ul>
 
 <h3>General</h3>



Mime
View raw message