---------- Forwarded message ---------- From: *Philippe Mouawad* <[email protected]> Date: Saturday, February 27, 2016 Subject: svn commit: r1732554 - in /jmeter/trunk: src/core/org/apache/jmeter/resources/ src/protocol/http/org/apache/jmeter/protocol/http/config/gui/ src/protocol/http/org/apache/jmeter/protocol/http/control/gui/ src/protocol/http/org/apache/jmeter/protocol/htt... To: "[email protected]" <[email protected]>
On Saturday, February 27, 2016, Milamber <[email protected] <javascript:_e(%7B%7D,'cvml','[email protected]');>> wrote: > > > On 26/02/2016 22:46, Philippe Mouawad wrote: > >> Hi Milamber, >> I didn't accept it quickly, I have been testing it for few days now. >> > > Please, distinct the test of the code and the code review phases. Code > review code is one of important part for the committers work about the > contribution from the community. Bruno, I think that I am doing code review and code fixing/enhancing in a serious way and spending a lot of my personal time on JMeter. You don't need to tell me that. We are speaking here about: - a french label (which by the way I don't find clear after your fix but it's on for me) - A formating issue which I didn't locate Please note that in the previous PR from B. Wiart I changed and fixed a dead code, so I am taking care of code quality. I am also fixing javadocs and namings whenever possible. > As a committer/pmc we needs to keep an clean code, a clean svn(/git) > history, etc. As a committer/pmc we needs to help the contributor to > provide patches/PR which respect the JMeter style code/policy. I think in this case that Benoit Wiart does not need any lesson from me, I think he masters the code and all best practices. Please note that for another contributor, I asked a correct format of patch. I also rejected a PR that contained a bug. I asked not to commit a 3rd one... And finally note all the documentation efforts I made on dashboard, on building and contributing. So let's close this debate good friends :) and prepare the new 3.0 release which should be awesome ! > > Milamber > > > Regarding your notes, find my answers inline. >> >> One note also regarding my PR merging policy: >> I would be a bit "ashamed" to "bother" or reject for example Benoit Wiart >> 's PR of this code size (or any other contributor contributing important >> bug fixes or enhancements) knowing besides that for this upcoming version >> he has contributed 92 Bugs/ Enhancements plus many code cleanups, which is >> I think more work than I have done myself. >> >> >> >> Regards >> Philippe M. >> >> On Fri, Feb 26, 2016 at 11:27 PM, Milamber <[email protected]> wrote: >> >> Hello, >>> >>> Please, don't accept a PR like this quickly >>> >>> This PR mixed a lot of changes: >>> >>> (in order: https://github.com/apache/jmeter/pull/140/files) >>> * Mark @Deprecated a class >>> >>> It is part of the fix >> >> * Change variable names/type >>> >>> It is part of the fix to make code more maintainable / readable >> >> * format/indent code >>> >>> Maybe it should not have been there, but my Merge policy is fix and >> commit, >> then mention. I admit that I don't pay a lot attention to formatting >> unless >> it really makes understanding difficult. >> I will try to pay more attention on this but I don't promise anything >> >> >> >> >> * add some format code issue (missing space between if and '(' ) (see line >>> 208 / 251 in new code / UrlConfigGui.java ) >>> >>> Same not as above >> >> * use constant string to key to replace hard code string (good practice) >>> >>> I didn't see it. >> >> And bad French translation for >>> >>> +post_files_upload=Upload de fichiers >>> Upload isn't a French word. The good word is "Téléchargement" (and l10n >>> string is "Téléchargement de fichiers" (the word Téléchargement don't >>> indicate the direction of traffic, but in this context, the 'upload' is >>> natural, so "Téléchargement the best french word to replace 'upload' >>> word.) >>> >>> Ok , that's exactly why I didn't use Téléchargement, because it is not >> clear regarding the direction. Upload for all french people I know is >> clear, I am sure the French Academy will soon accept it :-) and within >> the >> "new orthographe réforme" make it "euplaude" :-) >> >> >> Please fixes this L10N issue and format code issue. >>> >>> Feel free to fix it. I am going to bed :-) , will fix it tomorrow if you >> don't >> >> And recommend to the PR's people to do several commits to make several >>> type to changes in one PR on github. >>> >>> See my note above. >> >> Milamber >>> >>> >>> >>> On 26/02/2016 20:12, [email protected] wrote: >>> >>> Author: pmouawad >>>> Date: Fri Feb 26 20:12:33 2016 >>>> New Revision: 1732554 >>>> >>>> URL: http://svn.apache.org/viewvc?rev=1732554&view=rev >>>> Log: >>>> Bug 59060 - HTTP Request GUI : Move File Upload to a new Tab to have >>>> more >>>> space for parameters and prevent incoherent configuration >>>> Contributed by Benoit Wiart >>>> #resolve #140 >>>> https://github.com/apache/jmeter/pull/140 >>>> Bugzilla Id: 59060 >>>> >>>> Modified: >>>> >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >>>> >>>> >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >>>> >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java >>>> >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java >>>> >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java >>>> >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java >>>> jmeter/trunk/xdocs/changes.xml >>>> >>>> Modified: >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >>>> (original) >>>> +++ >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -727,6 +727,7 @@ port=Port\: >>>> post_as_parameters=Parameters >>>> post_body=Body Data >>>> post_body_raw=Body Data >>>> +post_files_upload=Files Upload >>>> post_thread_group_title=tearDown Thread Group >>>> previous=Previous >>>> property_as_field_label={0}\: >>>> >>>> Modified: >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >>>> (original) >>>> +++ >>>> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -712,6 +712,7 @@ port=Port \: >>>> post_as_parameters=Param\u00E8tres >>>> post_body=Corps de la requ\u00EAte >>>> post_body_raw=Donn\u00E9es de la requ\u00EAte >>>> +post_files_upload=Upload de fichiers >>>> post_thread_group_title=Groupe d'unit\u00E9s de fin >>>> previous=Pr\u00E9c\u00E9dent >>>> property_as_field_label={0}\: >>>> >>>> Modified: >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java >>>> (original) >>>> +++ >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/MultipartUrlConfigGui.java >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -28,6 +28,10 @@ import org.apache.jmeter.protocol.http.g >>>> import org.apache.jmeter.testelement.TestElement; >>>> import org.apache.jmeter.util.JMeterUtils; >>>> +/** >>>> + * @deprecated since 3.0 will be removed in the next version 3.1 >>>> + */ >>>> +@Deprecated >>>> public class MultipartUrlConfigGui extends UrlConfigGui { >>>> private static final long serialVersionUID = 240L; >>>> >>>> Modified: >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java >>>> (original) >>>> +++ >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/config/gui/UrlConfigGui.java >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -45,6 +45,7 @@ import org.apache.jmeter.gui.util.JSynta >>>> import org.apache.jmeter.gui.util.JTextScrollPane; >>>> import org.apache.jmeter.gui.util.VerticalPanel; >>>> import org.apache.jmeter.protocol.http.gui.HTTPArgumentsPanel; >>>> +import org.apache.jmeter.protocol.http.gui.HTTPFileArgsPanel; >>>> import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; >>>> import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory; >>>> import org.apache.jmeter.protocol.http.util.HTTPArgument; >>>> @@ -71,13 +72,17 @@ public class UrlConfigGui extends JPanel >>>> private static final int TAB_PARAMETERS = 0; >>>> - private static final int TAB_RAW_BODY = 1; >>>> + private int tabRawBodyIndex = 1; >>>> + >>>> + private int tabFileUploadIndex = 2; >>>> private static final Font FONT_DEFAULT = >>>> UIManager.getDefaults().getFont("TextField.font"); >>>> private static final Font FONT_SMALL = new >>>> Font("SansSerif", >>>> Font.PLAIN, (int) Math.round(FONT_DEFAULT.getSize() * 0.8)); >>>> private HTTPArgumentsPanel argsPanel; >>>> + >>>> + private HTTPFileArgsPanel filesPanel; >>>> private JTextField domain; >>>> @@ -115,8 +120,8 @@ public class UrlConfigGui extends JPanel >>>> private JLabeledChoice httpImplementation; >>>> - private final boolean notConfigOnly; >>>> // set this false to suppress some items for use in HTTP Request >>>> defaults >>>> + private final boolean notConfigOnly; >>>> private final boolean showImplementation; // Set false for >>>> AJP >>>> @@ -127,6 +132,7 @@ public class UrlConfigGui extends JPanel >>>> private ValidationTabbedPane postContentTabbedPane; >>>> private boolean showRawBodyPane; >>>> + private boolean showFileUploadPane; >>>> /** >>>> * Constructor which is setup to show HTTP implementation, raw >>>> body >>>> pane and >>>> @@ -155,9 +161,23 @@ public class UrlConfigGui extends JPanel >>>> * flag whether the raw body pane should be shown >>>> */ >>>> public UrlConfigGui(boolean showSamplerFields, boolean >>>> showImplementation, boolean showRawBodyPane) { >>>> - notConfigOnly=showSamplerFields; >>>> + this(showSamplerFields, showImplementation, showRawBodyPane, >>>> false); >>>> + } >>>> + >>>> + /** >>>> + * @param showSamplerFields >>>> + * flag whether sampler fields should be shown >>>> + * @param showImplementation >>>> + * Show HTTP Implementation >>>> + * @param showRawBodyPane >>>> + * flag whether the raw body pane should be shown >>>> + * @param showFileUploadPane flag whether the file upload pane >>>> should be shown >>>> + */ >>>> + public UrlConfigGui(boolean showSamplerFields, boolean >>>> showImplementation, boolean showRawBodyPane, boolean >>>> showFileUploadPane) { >>>> + this.notConfigOnly = showSamplerFields; >>>> this.showImplementation = showImplementation; >>>> this.showRawBodyPane = showRawBodyPane; >>>> + this.showFileUploadPane = showFileUploadPane; >>>> init(); >>>> } >>>> @@ -185,6 +205,9 @@ public class UrlConfigGui extends JPanel >>>> protocol.setText(""); // $NON-NLS-1$ >>>> contentEncoding.setText(""); // $NON-NLS-1$ >>>> argsPanel.clear(); >>>> + if(showFileUploadPane) { >>>> + filesPanel.clear(); >>>> + } >>>> if(showRawBodyPane) { >>>> postBodyContent.setInitialText("");// $NON-NLS-1$ >>>> } >>>> @@ -207,7 +230,7 @@ public class UrlConfigGui extends JPanel >>>> * @param element {@link TestElement} to modify >>>> */ >>>> public void modifyTestElement(TestElement element) { >>>> - boolean useRaw = >>>> postContentTabbedPane.getSelectedIndex()==TAB_RAW_BODY; >>>> + boolean useRaw = >>>> postContentTabbedPane.getSelectedIndex()==tabRawBodyIndex; >>>> Arguments args; >>>> if(useRaw) { >>>> args = new Arguments(); >>>> @@ -225,6 +248,9 @@ public class UrlConfigGui extends JPanel >>>> } else { >>>> args = (Arguments) argsPanel.createTestElement(); >>>> HTTPArgument.convertArgumentsToHTTP(args); >>>> + if(showFileUploadPane) { >>>> + filesPanel.modifyTestElement(element); >>>> + } >>>> } >>>> element.setProperty(HTTPSamplerBase.POST_BODY_RAW, useRaw, >>>> HTTPSamplerBase.POST_BODY_RAW_DEFAULT); >>>> element.setProperty(new >>>> TestElementProperty(HTTPSamplerBase.ARGUMENTS, args)); >>>> @@ -297,10 +323,13 @@ public class UrlConfigGui extends JPanel >>>> String postBody = computePostBody(arguments, true); // >>>> Convert CRLF to CR, see modifyTestElement >>>> postBodyContent.setInitialText(postBody); >>>> postBodyContent.setCaretPosition(0); >>>> - postContentTabbedPane.setSelectedIndex(TAB_RAW_BODY, >>>> false); >>>> + postContentTabbedPane.setSelectedIndex(tabRawBodyIndex, >>>> false); >>>> } else { >>>> argsPanel.configure(arguments); >>>> postContentTabbedPane.setSelectedIndex(TAB_PARAMETERS, >>>> false); >>>> + if(showFileUploadPane) { >>>> + filesPanel.configure(el); >>>> + } >>>> } >>>> >>>> domain.setText(el.getPropertyAsString(HTTPSamplerBase.DOMAIN)); >>>> @@ -580,12 +609,12 @@ public class UrlConfigGui extends JPanel >>>> protected JPanel getProtocolAndMethodPanel() { >>>> // Implementation >>>> - >>>> if (showImplementation) { >>>> httpImplementation = new >>>> JLabeledChoice(JMeterUtils.getResString("http_implementation"), // >>>> $NON-NLS-1$ >>>> HTTPSamplerFactory.getImplementations()); >>>> httpImplementation.addValue(""); >>>> } >>>> + >>>> // PROTOCOL >>>> protocol = new JTextField(4); >>>> JLabel protocolLabel = new >>>> JLabel(JMeterUtils.getResString("protocol")); // $NON-NLS-1$ >>>> @@ -627,26 +656,33 @@ public class UrlConfigGui extends JPanel >>>> postContentTabbedPane = new ValidationTabbedPane(); >>>> argsPanel = new HTTPArgumentsPanel(); >>>> >>>> >>>> postContentTabbedPane.add(JMeterUtils.getResString("post_as_parameters"), >>>> argsPanel);// $NON-NLS-1$ >>>> + >>>> + int indx = TAB_PARAMETERS; >>>> if(showRawBodyPane) { >>>> + tabRawBodyIndex = ++indx; >>>> postBodyContent = new JSyntaxTextArea(30, 50);// >>>> $NON-NLS-1$ >>>> >>>> postContentTabbedPane.add(JMeterUtils.getResString("post_body"), new >>>> JTextScrollPane(postBodyContent));// $NON-NLS-1$ >>>> } >>>> + >>>> + if(showFileUploadPane) { >>>> + tabFileUploadIndex = ++indx; >>>> + filesPanel = new HTTPFileArgsPanel(); >>>> + >>>> postContentTabbedPane.add(JMeterUtils.getResString("post_files_upload"), >>>> filesPanel); >>>> + } >>>> return postContentTabbedPane; >>>> } >>>> /** >>>> * >>>> */ >>>> - class ValidationTabbedPane extends JTabbedPane{ >>>> + class ValidationTabbedPane extends JTabbedPane { >>>> /** >>>> * >>>> */ >>>> private static final long serialVersionUID = >>>> 7014311238367882880L; >>>> - /* (non-Javadoc) >>>> - * @see javax.swing.JTabbedPane#setSelectedIndex(int) >>>> - */ >>>> + >>>> @Override >>>> public void setSelectedIndex(int index) { >>>> setSelectedIndex(index, true); >>>> @@ -662,23 +698,32 @@ public class UrlConfigGui extends JPanel >>>> * index >>>> */ >>>> public void setSelectedIndex(int index, boolean check) { >>>> - int oldSelectedIndex = getSelectedIndex(); >>>> - if(!check || oldSelectedIndex==-1) { >>>> + int oldSelectedIndex = this.getSelectedIndex(); >>>> + if(!check || oldSelectedIndex == -1) { >>>> super.setSelectedIndex(index); >>>> } >>>> - else if(index != this.getSelectedIndex()) >>>> + else if(index != oldSelectedIndex) >>>> { >>>> - if(noData(getSelectedIndex())) { >>>> - // If there is no data, then switching between >>>> Parameters and Raw should be >>>> - // allowed with no further user interaction. >>>> + // If there is no data, then switching between >>>> Parameters/file upload and Raw should be >>>> + // allowed with no further user interaction. >>>> + if(noData(oldSelectedIndex)) { >>>> argsPanel.clear(); >>>> postBodyContent.setInitialText(""); >>>> + if(showFileUploadPane) { >>>> + filesPanel.clear(); >>>> + } >>>> super.setSelectedIndex(index); >>>> } >>>> - else { >>>> - if(oldSelectedIndex == TAB_RAW_BODY) { >>>> + else { >>>> + boolean filePanelHasData = false; >>>> + if(showFileUploadPane) { >>>> + filePanelHasData = filesPanel.hasData(); >>>> + } >>>> + >>>> + if(oldSelectedIndex == tabRawBodyIndex) { >>>> + >>>> // If RAW data and Parameters match we allow >>>> switching >>>> - >>>> >>>> if(postBodyContent.getText().equals(computePostBody((Arguments)argsPanel.createTestElement()).trim())) >>>> { >>>> + if(index == TAB_PARAMETERS && >>>> >>>> postBodyContent.getText().equals(computePostBody((Arguments)argsPanel.createTestElement()).trim())) >>>> { >>>> super.setSelectedIndex(index); >>>> } >>>> else { >>>> @@ -693,9 +738,18 @@ public class UrlConfigGui extends JPanel >>>> } >>>> } >>>> else { >>>> - // If the Parameter data can be converted (i.e. >>>> no names), we >>>> - // warn the user that the Parameter data will >>>> be >>>> lost. >>>> - if(canConvertParameters()) { >>>> + // can switch from parameter to fileupload >>>> + if((oldSelectedIndex == TAB_PARAMETERS >>>> + && index == tabFileUploadIndex) >>>> + || (oldSelectedIndex == tabFileUploadIndex >>>> + && index == TAB_PARAMETERS)) { >>>> + super.setSelectedIndex(index); >>>> + return; >>>> + } >>>> + >>>> + // If the Parameter data can be converted (i.e. >>>> no names) and there is no data in file upload >>>> + // we warn the user that the Parameter data >>>> will >>>> be lost. >>>> + if(oldSelectedIndex == TAB_PARAMETERS && >>>> !filePanelHasData && canConvertParameters()) { >>>> Object[] options = { >>>> >>>> JMeterUtils.getResString("confirm"), // $NON-NLS-1$ >>>> >>>> JMeterUtils.getResString("cancel")}; // $NON-NLS-1$ >>>> @@ -718,8 +772,9 @@ public class UrlConfigGui extends JPanel >>>> else { >>>> // If the Parameter data cannot be >>>> converted to Raw, then the user should be >>>> // prevented from doing so raise an error >>>> dialog >>>> + String messageKey = >>>> >>>> filePanelHasData?"web_cannot_switch_tab":"web_cannot_convert_parameters_to_raw"; >>>> JOptionPane.showConfirmDialog(this, >>>> - >>>> JMeterUtils.getResString("web_cannot_convert_parameters_to_raw"), // >>>> $NON-NLS-1$ >>>> + >>>> JMeterUtils.getResString(messageKey), // $NON-NLS-1$ >>>> >>>> JMeterUtils.getResString("warning"), // $NON-NLS-1$ >>>> JOptionPane.DEFAULT_OPTION, >>>> JOptionPane.ERROR_MESSAGE); >>>> @@ -764,7 +819,7 @@ public class UrlConfigGui extends JPanel >>>> * @return true if no argument has a name >>>> */ >>>> boolean canConvertParameters() { >>>> - Arguments arguments = (Arguments)argsPanel.createTestElement(); >>>> + Arguments arguments = (Arguments) >>>> argsPanel.createTestElement(); >>>> for (int i = 0; i < arguments.getArgumentCount(); i++) { >>>> >>>> if(!StringUtils.isEmpty(arguments.getArgument(i).getName())) { >>>> return false; >>>> @@ -776,17 +831,22 @@ public class UrlConfigGui extends JPanel >>>> /** >>>> * Checks if no data is available in the selected tab >>>> * >>>> - * @param oldSelectedIndex >>>> - * the tab to check for data >>>> + * @param oldSelectedIndex the tab to check for data >>>> * @return true if neither Parameters tab nor Raw Body tab >>>> contain >>>> data >>>> */ >>>> boolean noData(int oldSelectedIndex) { >>>> - if(oldSelectedIndex == TAB_RAW_BODY) { >>>> + if(oldSelectedIndex == tabRawBodyIndex) { >>>> return >>>> StringUtils.isEmpty(postBodyContent.getText().trim()); >>>> } >>>> else { >>>> - Arguments element = >>>> (Arguments)argsPanel.createTestElement(); >>>> - return StringUtils.isEmpty(computePostBody(element)); >>>> + boolean noData = true; >>>> + Arguments element = (Arguments) >>>> argsPanel.createTestElement(); >>>> + >>>> + if(showFileUploadPane) { >>>> + noData &= !filesPanel.hasData(); >>>> + } >>>> + >>>> + return noData && >>>> StringUtils.isEmpty(computePostBody(element)); >>>> } >>>> } >>>> } >>>> >>>> Modified: >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java >>>> (original) >>>> +++ >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/gui/HttpTestSampleGui.java >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -34,7 +34,7 @@ import javax.swing.UIManager; >>>> import org.apache.jmeter.gui.util.HorizontalPanel; >>>> import org.apache.jmeter.gui.util.VerticalPanel; >>>> -import >>>> org.apache.jmeter.protocol.http.config.gui.MultipartUrlConfigGui; >>>> +import org.apache.jmeter.protocol.http.config.gui.UrlConfigGui; >>>> import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase; >>>> import org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy; >>>> import org.apache.jmeter.samplers.gui.AbstractSamplerGui; >>>> @@ -56,7 +56,7 @@ public class HttpTestSampleGui extends A >>>> private static final Font FONT_SMALL = new Font("SansSerif", >>>> Font.PLAIN, (int) Math.round(FONT_DEFAULT.getSize() * 0.8)); >>>> - private MultipartUrlConfigGui urlConfigGui; >>>> + private UrlConfigGui urlConfigGui; >>>> private JCheckBox getImages; >>>> @@ -158,7 +158,7 @@ public class HttpTestSampleGui extends A >>>> add(makeTitlePanel(), BorderLayout.NORTH); >>>> // URL CONFIG >>>> - urlConfigGui = new MultipartUrlConfigGui(true, !isAJP); >>>> + urlConfigGui = new UrlConfigGui(true, !isAJP, true, true); >>>> add(urlConfigGui, BorderLayout.CENTER); >>>> // Bottom (embedded resources, source address and optional >>>> tasks) >>>> >>>> Modified: >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java >>>> (original) >>>> +++ >>>> >>>> jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/gui/HTTPFileArgsPanel.java >>>> Fri Feb 26 20:12:33 2016 >>>> @@ -20,18 +20,14 @@ package org.apache.jmeter.protocol.http. >>>> import java.awt.BorderLayout; >>>> import java.awt.Component; >>>> -import java.awt.Cursor; >>>> import java.awt.FlowLayout; >>>> import java.awt.event.ActionEvent; >>>> import java.awt.event.ActionListener; >>>> -import java.awt.event.MouseAdapter; >>>> -import java.awt.event.MouseEvent; >>>> import java.io.File; >>>> import java.util.Iterator; >>>> import javax.swing.BorderFactory; >>>> import javax.swing.Box; >>>> -import javax.swing.ImageIcon; >>>> import javax.swing.JButton; >>>> import javax.swing.JFileChooser; >>>> import javax.swing.JLabel; >>>> @@ -39,7 +35,6 @@ import javax.swing.JPanel; >>>> import javax.swing.JScrollPane; >>>> import javax.swing.JTable; >>>> import javax.swing.ListSelectionModel; >>>> -import javax.swing.SwingConstants; >>>> import javax.swing.table.TableCellEditor; >>>> import org.apache.jmeter.gui.util.FileDialoger; >>>> @@ -66,6 +61,7 @@ public class HTTPFileArgsPanel extends J >>>> private static final long serialVersionUID = 240L; >>>> /** The title label for this component. */ >>>> + @Deprecated >>>> private JLabel tableLabel; >>>> /** The table containing the list of files. */ >>>> @@ -100,47 +96,25 @@ public class HTTPFileArgsPanel extends J >>>> /** The mime type column title of file table. */ >>>> private static final String MIMETYPE = "send_file_mime_label"; >>>> //$NON-NLS-1$ >>>> + >>>> + /** >>>> + * Create a new HTTPFileArgsPanel as an embedded component >>>> + */ >>>> public HTTPFileArgsPanel() { >>>> - this(""); // required for unit tests >>>> + init(); >>>> } >>>> - >>>> + >>>> /** >>>> * Create a new HTTPFileArgsPanel as an embedded component, using >>>> the >>>> * specified title. >>>> * >>>> - * @param label >>>> - * the title for the component. >>>> + * @param label the title for the component. >>>> + * @deprecated will be removed in the next version >>>> */ >>>> + @Deprecated >>>> public HTTPFileArgsPanel(String label) { >>>> - ImageIcon image = JMeterUtils.getImage("collapse-open.png"); >>>> - tableLabel = new JLabel(label, image, SwingConstants.LEFT); >>>> + tableLabel = new JLabel(label); >>>> init(); >>>> - >>>> tableLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); >>>> - >>>> tableLabel.setToolTipText(JMeterUtils.getResString("collapse_tooltip")); >>>> - tableLabel.addMouseListener(new MouseAdapter() { >>>> - @Override >>>> - public void mouseClicked(MouseEvent e) { >>>> - hideFileArgsMainPanel(null); >>>> - } >>>> - }); >>>> - } >>>> - >>>> - private void hideFileArgsMainPanel(Boolean force) { >>>> - BorderLayout bl = (BorderLayout) this.getLayout(); >>>> - >>>> - boolean result = false; >>>> - String[] borders = {BorderLayout.CENTER, BorderLayout.WEST, >>>> BorderLayout.SOUTH}; >>>> - for (String border : borders) { >>>> - Component tableComponent = bl.getLayoutComponent(border); >>>> - if(tableComponent != null) { >>>> - boolean visible = >>>> force!=null?force.booleanValue():!tableComponent.isVisible(); >>>> - tableComponent.setVisible(visible); >>>> - >>>> - result |= visible; >>>> - } >>>> - } >>>> - >>>> - >>>> >>>> tableLabel.setIcon(result?JMeterUtils.getImage("collapse-open.png"):JMeterUtils.getImage("collapse-close.png")); >>>> } >>>> /** >>>> @@ -162,7 +136,7 @@ public class HTTPFileArgsPanel extends J >>>> } >>>> public static boolean testFunctors(){ >>>> - HTTPFileArgsPanel instance = new HTTPFileArgsPanel(""); >>>> //$NON-NLS-1$ >>>> + HTTPFileArgsPanel instance = new HTTPFileArgsPanel(); >>>> instance.initializeTableModel(); >>>> return >>>> instance.tableModel.checkFunctors(null,instance.getClass()); >>>> } >>>> @@ -191,14 +165,18 @@ public class HTTPFileArgsPanel extends J >>>> @SuppressWarnings("unchecked") // we only put >>>> HTTPFileArgs >>>> in it >>>> Iterator<HTTPFileArg> modelData = (Iterator<HTTPFileArg>) >>>> tableModel.iterator(); >>>> HTTPFileArg[] files = new HTTPFileArg[rows]; >>>> - int row=0; >>>> + int row = 0; >>>> while (modelData.hasNext()) { >>>> HTTPFileArg file = modelData.next(); >>>> - files[row++]=file; >>>> + files[row++] = file; >>>> } >>>> base.setHTTPFiles(files); >>>> } >>>> } >>>> + >>>> + public boolean hasData() { >>>> + return tableModel.iterator().hasNext(); >>>> + } >>>> /** >>>> * A newly created component can be initialized with the contents >>>> of a >>>> @@ -230,11 +208,9 @@ public class HTTPFileArgsPanel extends J >>>> if (tableModel.getRowCount() == 0) { >>>> browse.setEnabled(false); >>>> delete.setEnabled(false); >>>> - hideFileArgsMainPanel(Boolean.FALSE); >>>> } else { >>>> browse.setEnabled(true); >>>> delete.setEnabled(true); >>>> - hideFileArgsMainPanel(Boolean.TRUE); >>>> } >>>> } >>>> @@ -372,9 +348,9 @@ public class HTTPFileArgsPanel extends J >>>> /** >>>> * Create a panel containing the title label for the table. >>>> - * >>>> * @return a panel containing the title label >>>> */ >>>> + @Deprecated >>>> private Component makeLabelPanel() { >>>> JPanel labelPanel = new JPanel(new >>>> FlowLayout(FlowLayout.LEFT)); >>>> labelPanel.add(tableLabel); >>>> @@ -418,7 +394,10 @@ public class HTTPFileArgsPanel extends J >>>> p.setLayout(new BorderLayout()); >>>> - p.add(makeLabelPanel(), BorderLayout.NORTH); >>>> + // retro compatibility, will be removed in the next version >>>> + if(tableLabel != null) { >>>> + p.add(makeLabelPanel(), BorderLayout.NORTH); >>>> + } >>>> p.add(makeMainPanel(), BorderLayout.CENTER); >>>> // Force a minimum table height of 70 pixels >>>> p.add(Box.createVerticalStrut(70), BorderLayout.WEST); >>>> >>>> Modified: jmeter/trunk/xdocs/changes.xml >>>> URL: >>>> >>>> http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1732554&r1=1732553&r2=1732554&view=diff >>>> >>>> >>>> ============================================================================== >>>> --- jmeter/trunk/xdocs/changes.xml (original) >>>> +++ jmeter/trunk/xdocs/changes.xml Fri Feb 26 20:12:33 2016 >>>> @@ -116,6 +116,7 @@ Summary >>>> <li><bug>59028</bug>Use SystemDefaultDnsResolver singleton. >>>> Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li> >>>> <li><bug>59036</bug>FormCharSetFinder : Use JSoup instead of >>>> deprecated HTMLParser</li> >>>> <li><bug>59034</bug>Parallel downloads connection management is >>>> not >>>> realistic. Contributed by Benoit Wiart (benoit dot wiart at gmail.com) >>>> and Philippe Mouawad</li> >>>> + <li><bug>59060</bug>HTTP Request GUI : Move File Upload to a new >>>> Tab >>>> to have more space for parameters and prevent incoherent configuration. >>>> Contributed by Benoit Wiart (benoit dot wiart at gmail.com)</li> >>>> </ul> >>>> <h3>Other samplers</h3> >>>> >>>> >>>> >>>> >>>> >> > -- Cordialement. Philippe Mouawad. -- Cordialement. Philippe Mouawad.
