jmeter-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pmoua...@apache.org
Subject svn commit: r1814275 - in /jmeter/trunk: src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java xdocs/changes.xml
Date Sat, 04 Nov 2017 11:04:37 GMT
Author: pmouawad
Date: Sat Nov  4 11:04:37 2017
New Revision: 1814275

URL: http://svn.apache.org/viewvc?rev=1814275&view=rev
Log:
Bug 53957 - HTTP Request : In Parameters tab, allow pasting of content coming from Firefox
and Chrome (unparsed)
Bugzilla Id: 53957

Modified:
    jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
    jmeter/trunk/xdocs/changes.xml

Modified: jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java?rev=1814275&r1=1814274&r2=1814275&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java (original)
+++ jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java Sat Nov  4 11:04:37
2017
@@ -118,6 +118,12 @@ public class ArgumentsPanel extends Abst
     /** Command for moving a row down in the table. */
     private static final String DOWN = "down"; // $NON-NLS-1$
 
+    /** When pasting from the clipboard, split lines on linebreak */
+    private static final String CLIPBOARD_LINE_DELIMITERS = "\n"; //$NON-NLS-1$
+
+    /** When pasting from the clipboard, split parameters on tab */
+    private static final String CLIPBOARD_ARG_DELIMITERS = "\t"; //$NON-NLS-1$
+
     /** Command for showing detail. */
     private static final String DETAIL = "detail"; // $NON-NLS-1$
 
@@ -531,8 +537,10 @@ public class ArgumentsPanel extends Abst
 
     /**
      * Add values from the clipboard
+     * @param lineDelimiter Delimiter string to split clipboard into lines
+     * @param argDelimiter Delimiter string to split line into key-value pair
      */
-    protected void addFromClipboard() {
+    protected void addFromClipboard(String lineDelimiter, String argDelimiter) {
         GuiUtils.stopTableEditing(table);
         int rowCount = table.getRowCount();
         try {
@@ -540,9 +548,9 @@ public class ArgumentsPanel extends Abst
             if(clipboardContent == null) {
                 return;
             }
-            String[] clipboardLines = clipboardContent.split("\n");
+            String[] clipboardLines = clipboardContent.split(lineDelimiter);
             for (String clipboardLine : clipboardLines) {
-                String[] clipboardCols = clipboardLine.split("\t");
+                String[] clipboardCols = clipboardLine.split(argDelimiter);
                 if (clipboardCols.length > 0) {
                     Argument argument = createArgumentFromClipboard(clipboardCols);
                     tableModel.addRow(argument);
@@ -567,6 +575,10 @@ public class ArgumentsPanel extends Abst
         }
     }
 
+    protected void addFromClipboard() {
+        addFromClipboard(CLIPBOARD_LINE_DELIMITERS, CLIPBOARD_ARG_DELIMITERS);
+    }
+
     protected Argument createArgumentFromClipboard(String[] clipboardCols) {
         Argument argument = makeNewArgument();
         argument.setName(clipboardCols[0]);

Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java?rev=1814275&r1=1814274&r2=1814275&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
(original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPArgumentsPanel.java
Sat Nov  4 11:04:37 2017
@@ -50,6 +50,12 @@ public class HTTPArgumentsPanel extends
 
     private static final String INCLUDE_EQUALS = "include_equals"; //$NON-NLS-1$
 
+    /** When pasting from the clipboard, split lines on linebreak or '&' */
+    private static final String CLIPBOARD_LINE_DELIMITERS = "\n|&"; //$NON-NLS-1$
+
+    /** When pasting from the clipboard, split parameters on tab or '=' */
+    private static final String CLIPBOARD_ARG_DELIMITERS = "\t|="; //$NON-NLS-1$
+
     @Override
     protected void initializeTableModel() {
         tableModel = new ObjectTableModel(new String[] {
@@ -142,6 +148,11 @@ public class HTTPArgumentsPanel extends
     }
 
     @Override
+    protected void addFromClipboard() {
+        addFromClipboard(CLIPBOARD_LINE_DELIMITERS, CLIPBOARD_ARG_DELIMITERS);
+    }
+
+    @Override
     protected Argument createArgumentFromClipboard(String[] clipboardCols) {
         HTTPArgument argument = makeNewArgument();
         argument.setName(clipboardCols[0]);
@@ -151,10 +162,10 @@ public class HTTPArgumentsPanel extends
             if (clipboardCols.length > 2) {
                 
                 // default to false if the string is not a boolean
-                argument.setAlwaysEncoded(Boolean.parseBoolean(clipboardCols[2]));
+                argument.setAlwaysEncoded(Boolean.parseBoolean(clipboardCols[2].trim()));
                 
                 if (clipboardCols.length > 3) {
-                    Boolean useEqual = BooleanUtils.toBooleanObject(clipboardCols[3]);
+                    Boolean useEqual = BooleanUtils.toBooleanObject(clipboardCols[3].trim());
                     // default to true if the string is not a boolean
                     argument.setUseEquals(useEqual!=null?useEqual.booleanValue():true);
                 }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1814275&r1=1814274&r2=1814275&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov  4 11:04:37 2017
@@ -89,6 +89,7 @@ Summary
     <li><pr>316</pr> - Warn about empty truststore loading. Contributed
by Vincent Herilier (https://github.com/vherilier)</li>
     <li><bug>61639</bug>HTTP(S) Test Script Recorder : In request filtering
tab, uncheck by default "Notify Child Listeners of filtered samplers"</li>
     <li><bug>61672</bug>HTTP(S) Test Script Recorder : When a prefix is
set don't use path in Sampler Name</li>
+    <li><bug>53957</bug>HTTP Request : In Parameters tab, allow pasting
of content coming from Firefox and Chrome (unparsed)</li>
 </ul>
 
 <h3>Other samplers</h3>



Mime
View raw message