Re: svn commit: r1180205 - in /jakarta/jmeter/trunk/src: core/org/apache/jmeter/config/gui/ArgumentsPanel.java core/org/apache/jmeter/resources/messages.properties jorphan/org/apache/jorphan/gui/Objec

2011-10-11 Thread Milamber
Hello,

This commit adds a Up/Down button on  Function Helper Dialog window.
This is not good, because moving the ordering parameters make some
errors in function helper results (tested with the new ramdom string
function).

Milamber

Le 07/10/2011 20:30, pmoua...@apache.org a ecrit :
> Author: pmouawad
> Date: Fri Oct  7 20:30:33 2011
> New Revision: 1180205
>
> URL: http://svn.apache.org/viewvc?rev=1180205&view=rev
> Log:
> Bug 51817 - Moving variables up and down in User Defined Variables control.
>
> Fixed a ConcurrentModificationException in ObjectTableModel#moveRow I had to 
> use.
>
> Modified:
> 
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> 
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
> 
> jakarta/jmeter/trunk/src/jorphan/org/apache/jorphan/gui/ObjectTableModel.java
>
> Modified: 
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
> URL: 
> http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java?rev=1180205&r1=1180204&r2=1180205&view=diff
> ==
> --- 
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
>  (original)
> +++ 
> jakarta/jmeter/trunk/src/core/org/apache/jmeter/config/gui/ArgumentsPanel.java
>  Fri Oct  7 20:30:33 2011
> @@ -81,12 +81,24 @@ public class ArgumentsPanel extends Abst
>   */
>  private boolean standalone = true;
>  
> +/** Button to move a argument up*/
> +private JButton up;
> +
> +/** Button to move a argument down*/
> +private JButton down;
> +
>  /** Command for adding a row to the table. */
>  private static final String ADD = "add"; // $NON-NLS-1$
>  
>  /** Command for removing a row from the table. */
>  private static final String DELETE = "delete"; // $NON-NLS-1$
>  
> +/** Command for moving a row up in the table. */
> +private static final String UP = "up"; // $NON-NLS-1$
> +
> +/** Command for moving a row down in the table. */
> +private static final String DOWN = "down"; // $NON-NLS-1$
> +
>  public static final String COLUMN_RESOURCE_NAMES_0 = "name"; // 
> $NON-NLS-1$
>  
>  public static final String COLUMN_RESOURCE_NAMES_1 = "value"; // 
> $NON-NLS-1$
> @@ -239,6 +251,11 @@ public class ArgumentsPanel extends Abst
>  } else {
>  delete.setEnabled(true);
>  }
> +
> +if(tableModel.getRowCount()>1) {
> +up.setEnabled(true);
> +down.setEnabled(true);
> +}
>  }
>  
>  @Override
> @@ -268,19 +285,56 @@ public class ArgumentsPanel extends Abst
>  deleteArgument();
>  } else if (action.equals(ADD)) {
>  addArgument();
> +} else if (action.equals(UP)) {
> +moveUp();
> +} else if (action.equals(DOWN)) {
> +moveDown();
>  }
>  }
>  
>  /**
> - * Remove the currently selected argument from the table.
> + * Cancel cell editing if it is being edited
>   */
> -protected void deleteArgument() {
> +private void cancelEditing() {
>  // If a table cell is being edited, we must cancel the editing before
>  // deleting the row
>  if (table.isEditing()) {
>  TableCellEditor cellEditor = 
> table.getCellEditor(table.getEditingRow(), table.getEditingColumn());
>  cellEditor.cancelCellEditing();
>  }
> +}
> +
> +/**
> + * Move a row down
> + */
> +private void moveDown() {
> +cancelEditing();
> +
> +int rowSelected = table.getSelectedRow();
> +if (rowSelected < table.getRowCount()-1) {
> +tableModel.moveRow(rowSelected, rowSelected+1, rowSelected+1);
> +table.setRowSelectionInterval(rowSelected+1, rowSelected+1);
> +}
> +}
> +
> +/**
> + *  Move a row down
> + */
> +private void moveUp() {
> +cancelEditing();
> +
> +int rowSelected = table.getSelectedRow();
> +if (rowSelected > 0) {
> +tableModel.moveRow(rowSelected, rowSelected+1, rowSelected-1);
> +table.setRowSelectionInterval(rowSelected-1, rowSelected-1);
> +} 
> +}
> +
> +/**
> + * Remove the currently selected argument from the table.
> + */
> +protected void deleteArgument() {
> +cancelEditing();
>  
>  int rowSelected = table.getSelectedRow();
>  if (rowSelected >= 0) {
> @@ -291,6 +345,11 @@ public class ArgumentsPanel extends Abst
>  if (tableModel.getRowCount() == 0) {
>  delete.setEnabled(false);
>  }
> +
> +if(tableModel.getRowCount()>1) {
> +up.setEnabled(true);
> +down.setEnabled(true);
> +}
>  
>  // Table still contains one or

Re: [JMeter] Issue 51861 - Improve HTTP Request GUI to better show parameters without name (Raw Body)

2011-10-11 Thread sebb
On 9 October 2011 10:41, Philippe Mouawad  wrote:
> Hello Sebb,
> Regarding this, if we add a checkbox in Request Sampler GUI to indicate to
> user that merge will occur on request.
> This would be checked by default unless user switches to RAW body, if switch
> is accepted, checkbox is unchecked
>
> So we would have this behaviour:
>
>   - RAW body used, no merge
>   - Post Parameter , merge occurs
>
>
> What's your opinion, do you see other issues ?

I'm not sure I want to see yet another checkbox on that screen.
Seems to me we should try to use the raw body flag to control the behaviour.

So if the raw flag is set, we don't do a merge; otherwise keep current
behaviour.

I think we should probably disable the raw option entirely for Http
Defaults, otherwise I think it will be treated as an unnamed parameter
and merged with any non-raw samplers. That would be quite confusing.

Another possibility would be to use a separate JMX attribute for the
raw body (default omitted if empty).
This would make switching easier, as the panes would not share storage areas.

Also need to look at whether the samplers can share common code for
generating the request body.
We need to look at that whether or not we use a separate JMX
atttribute, because that is where any merging is done currently.

The samples currently use
HTTPSamplerBase.getSendParameterValuesAsPostBody() to check if the
request body is being generated from param values.

Perhaps the first stage should be to try to extract all the common
code that builds the body and move that into the parent class.

> Thanks
>
> Regards
> Philippe
>
> On Wed, Sep 28, 2011 at 4:52 PM, sebb  wrote:
>
>> If HttpDefaults and HttpRequest both use Parameters, then the body is
>> created from both sets of parameters.
>>
>> When the body is being built, if any of the parameters have names,
>> only named parameters are kept.
>> Any unnamed parameters are ignored.
>> It's not possible to mix named and unnamed parameters; named
>> parameters take precedence.
>>
>> If both test elements have unnamed variables only, then the body is
>> created from the merging of the two sets of values.
>>
>> That is existing behaviour, and cannot be changed without potentially
>> affecting users.
>>
>> Now the raw body option is currently handled as an un-named parameter.
>> This means that the a Raw HTTP Request will be ignored if there is a
>> named default parameter, and unnamed default parameters will be
>> appended to the body.
>>
>> That does not seem right; I would expect the raw option to provide the
>> complete body.
>>
>> This will mean a change to the way defaults are handled.
>>
>> I think this needs more discussion.
>>
>> It could take a while to resolve the issues and debug the code, so I
>> think it will have to wait for a later version of JMeter; I've held up
>> the current one long enough!
>>
>> -
>> To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org
>> For additional commands, e-mail: dev-h...@jakarta.apache.org
>>
>>
>
>
> --
> Cordialement.
> Philippe Mouawad.
>

-
To unsubscribe, e-mail: dev-unsubscr...@jakarta.apache.org
For additional commands, e-mail: dev-h...@jakarta.apache.org