You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2016/01/14 14:22:55 UTC

svn commit: r1724602 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java xdocs/changes.xml

Author: pmouawad
Date: Thu Jan 14 13:22:54 2016
New Revision: 1724602

URL: http://svn.apache.org/viewvc?rev=1724602&view=rev
Log:
Bug 58845 - Request http view doesn't display all the parameters
#resolve #70
Bugzilla Id: 58845

Modified:
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java?rev=1724602&r1=1724601&r2=1724602&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/visualizers/RequestViewHTTP.java Thu Jan 14 13:22:54 2016
@@ -191,14 +191,18 @@ public class RequestViewHTTP implements
                     }
                     queryGet += queryPost;
                 }
+                
                 queryGet = RequestViewHTTP.decodeQuery(queryGet);
                 if (queryGet != null) {
-                    Set<Entry<String, String>> keys = RequestViewHTTP.getQueryMap(queryGet).entrySet();
-                    for (Entry<String, String> entry : keys) {
-                        paramsModel.addRow(new RowResult(entry.getKey(),entry.getValue()));
+                    Set<Entry<String, String[]>> keys = RequestViewHTTP.getQueryMap(queryGet).entrySet();
+                    for (Entry<String, String[]> entry : keys) {
+                        for (String value : entry.getValue()) {
+                            paramsModel.addRow(new RowResult(entry.getKey(), value));                            
+                        }
                     }
                 }
             }
+            
             // Display cookie in headers table (same location on http protocol)
             String cookie = sampleResult.getCookies();
             if (cookie != null && cookie.length() > 0) {
@@ -206,6 +210,7 @@ public class RequestViewHTTP implements
                         JMeterUtils.getParsedLabel("view_results_table_request_http_cookie"), //$NON-NLS-1$
                         sampleResult.getCookies()));
             }
+            
             // Parsed request headers
             LinkedHashMap<String, String> lhm = JMeterUtils.parseHeaders(sampleResult.getRequestHeaders());
             for (Entry<String, String> entry : lhm.entrySet()) {
@@ -225,23 +230,25 @@ public class RequestViewHTTP implements
      * @return Map params and Svalue
      */
     //TODO: move to utils class (JMeterUtils?)
-    public static Map<String, String> getQueryMap(String query) {
+    public static Map<String, String[]> getQueryMap(String query) {
 
-        Map<String, String> map = new HashMap<>();
+        Map<String, String[]> map = new HashMap<>();
         if (query.trim().startsWith("<?")) { // $NON-NLS-1$
             // SOAP request (generally)
-            map.put(" ", query); //blank name // $NON-NLS-1$
+            map.put(" ", new String[] {query}); //blank name // $NON-NLS-1$
             return map;
         }
+        
         String[] params = query.split(PARAM_CONCATENATE);
         for (String param : params) {
             String[] paramSplit = param.split("="); // $NON-NLS-1$
             if (paramSplit.length > 2 ) {// detected invalid syntax (Bug 52491)
                 // Return as for SOAP above
                 map.clear();
-                map.put(" ", query); //blank name // $NON-NLS-1$
+                map.put(" ", new String[] {query}); //blank name // $NON-NLS-1$
                 return map;
             }
+            
             String name = null;
             if (paramSplit.length > 0) {
                 name = paramSplit[0];
@@ -251,7 +258,18 @@ public class RequestViewHTTP implements
                 // We use substring to keep = sign (Bug 54055), we are sure = is present
                 value = param.substring(param.indexOf("=")+1); // $NON-NLS-1$
             }
-            map.put(name, value);
+            
+            String[] known = map.get(name);
+            if(known == null) {
+                known = new String[] {value};
+            }
+            else {
+                String[] tmp = new String[known.length+1];
+                tmp[tmp.length-1] = value;
+                System.arraycopy(known, 0, tmp, 0, known.length);
+                known = tmp;
+            }
+            map.put(name, known);
         }
         return map;
     }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1724602&r1=1724601&r2=1724602&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Thu Jan 14 13:22:54 2016
@@ -84,7 +84,8 @@ Summary
     <li>Property <code>jmeterthread.reversePostProcessors</code> has been removed. See <bugzilla>58728</bugzilla></li>  
     <li>MongoDB elements (MongoDB Source Config, MongoDB Script) have been deprecated and will be removed in next version of jmeter. They do not appear anymore in the menu, if you need them modify <code>not_in_menu</code> property. JMeter team advises not to use them anymore. See <bugzilla>58772</bugzilla></li>
     <li>Summariser listener now outputs a formated duration in HH:mm:ss (Hour:Minute:Second), it previously outputed seconds. See <bugzilla>58776</bugzilla></li>
-    <li>WebService(SOAP) Request and HTML Parameter Mask which were deprecated in 2.13 version, have now been removed following our <a href="./usermanual/best-practices.html#deprecation">deprecation strategy</a></li> 
+    <li>WebService(SOAP) Request and HTML Parameter Mask which were deprecated in 2.13 version, have now been removed following our <a href="./usermanual/best-practices.html#deprecation">deprecation strategy</a></li>
+    <li>org.apache.jmeter.protocol.http.visualizers.RequestViewHTTP.getQueryMap signature has changed, if you use it ensure you update your code. See <bugzilla>58845</bugzilla></li> 
 </ul>
 
 <!-- =================== Improvements =================== -->
@@ -233,7 +234,8 @@ Summary
 
 <h3>Listeners</h3>
 <ul>
-<li><bug>58033</bug> SampleResultConverter should note that it cannot record non-TEXT data</li>
+<li><bug>58033</bug>SampleResultConverter should note that it cannot record non-TEXT data</li>
+<li><bug>58845</bug>Request http view doesn't display all the parameters. Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li>
 </ul>
 
 <h3>Timers, Assertions, Config, Pre- &amp; Post-Processors</h3>