Done 2017-11-11 22:06 GMT+01:00 Philippe Mouawad <[email protected]>:
> Hi Antonio, > Thanks for fixing this. > > Find 1 remark below. > Regards > > On Sat, Nov 11, 2017 at 9:49 PM, <[email protected]> wrote: > > > Author: agomes > > Date: Sat Nov 11 20:49:03 2017 > > New Revision: 1814971 > > > > URL: http://svn.apache.org/viewvc?rev=1814971&view=rev > > Log: > > Bug 61672 - add tht choice between prefix and transaction name to name > > sampler during recording > > > > 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/proxy/ > > DefaultSamplerCreator.java > > jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/ > > HttpRequestHdr.java > > jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/Proxy.java > > jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/ > > ProxyControl.java > > jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/gui/ProxyControlGui.java > > jmeter/trunk/xdocs/changes.xml > > jmeter/trunk/xdocs/images/screenshots/proxy_control.png > > jmeter/trunk/xdocs/usermanual/component_reference.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= > > 1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/core/org/apache/jmeter/resources/ > messages.properties > > (original) > > +++ jmeter/trunk/src/core/org/apache/jmeter/resources/ > messages.properties > > Sat Nov 11 20:49:03 2017 > > @@ -787,7 +787,6 @@ proxy_general_lifecycle=State > > proxy_general_settings=Global Settings > > proxy_headers=Capture HTTP Headers > > proxy_pause_http_sampler=Create new transaction after request (ms)\: > > -proxy_prefix_http_sampler_name=Prefix\: > > proxy_regex=Regex matching > > proxy_sampler_settings=HTTP Sampler settings > > proxy_sampler_type=Type\: > > @@ -936,6 +935,8 @@ run_threadgroup_no_timers=Start no pause > > running_test=Running test > > runtime_controller_title=Runtime Controller > > runtime_seconds=Runtime (seconds) > > +sample_name_prefix=Prefix > > +sample_name_transaction=Transaction name > > salt_string=Salt to be used for hashing (optional) > > sample_result_save_configuration=Sample Result Save Configuration > > sample_scope=Apply to: > > > > 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= > > 1814971&r1=1814970&r2=1814971&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 > > Sat Nov 11 20:49:03 2017 > > @@ -777,7 +777,6 @@ proxy_general_lifecycle=Etat > > proxy_general_settings=Param\u00E8tres g\u00E9n\u00E9raux > > proxy_headers=Capturer les ent\u00EAtes HTTP > > proxy_pause_http_sampler=Cr\u00E9er une nouvelle transaction apr\u00E8s > > la requ\u00EAte (ms) \: > > -proxy_prefix_http_sampler_name=Pr\u00E9fixe \: > > proxy_regex=Correspondance des variables par regex ? > > proxy_sampler_settings=Param\u00E8tres Echantillon HTTP > > proxy_sampler_type=Type \: > > @@ -926,6 +925,8 @@ run_threadgroup_no_timers=Lancer sans pa > > running_test=Lancer test > > runtime_controller_title=Contr\u00F4leur Dur\u00E9e d'ex\u00E9cution > > runtime_seconds=Temps d'ex\u00E9cution (secondes) \: > > +sample_name_prefix=Pr\u00E9fixe > > +sample_name_transaction=Nom de la transaction > > salt_string=Sel \u00e0 utiliser pour le hash > > sample_result_save_configuration=Sauvegarder la configuration de la > > sauvegarde des \u00E9chantillons > > sample_scope=Appliquer sur > > > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/DefaultSamplerCreator.java > > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ > > http/org/apache/jmeter/protocol/http/proxy/DefaultSamplerCreator.java? > > rev=1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/DefaultSamplerCreator.java > > (original) > > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/DefaultSamplerCreator.java > > Sat Nov 11 20:49:03 2017 > > @@ -54,6 +54,12 @@ import org.xml.sax.helpers.DefaultHandle > > */ > > public class DefaultSamplerCreator extends AbstractSamplerCreator { > > private static final Logger log = LoggerFactory.getLogger( > > DefaultSamplerCreator.class); > > + > > + /* > > + * Must be the same order than in org.apache.jmeter.protocol. > http.proxy.gui.ProxyControlGui > > class in createHTTPSamplerPanel method > > + */ > > + private static final int SAMPLER_NAME_NAMING_MODE_PREFIX = 0; // > > $NON-NLS-1$ > > + private static final int SAMPLER_NAME_NAMING_MODE_COMPLETE = 1; // > > $NON-NLS-1$ > > > > /** > > * > > @@ -275,15 +281,28 @@ public class DefaultSamplerCreator exten > > protected void computeSamplerName(HTTPSamplerBase sampler, > > HttpRequestHdr request) { > > String prefix = request.getPrefix(); > > + int HttpSampleNameMode = request.getHttpSampleNameMode(); > > if (!HTTPConstants.CONNECT.equals(request.getMethod()) && > > isNumberRequests()) { > > if(!StringUtils.isEmpty(prefix)) { > > - sampler.setName(incrementRequestNumberAndGet() + " " + > > prefix); > > + if (HttpSampleNameMode==SAMPLER_ > NAME_NAMING_MODE_PREFIX) > > { > > + sampler.setName(prefix + incrementRequestNumberAndGet() > + > > " " + sampler.getPath()); > > + } else if (HttpSampleNameMode==SAMPLER_ > NAME_NAMING_MODE_COMPLETE) > > { > > + sampler.setName(incrementRequestNumberAndGet() + " > " > > + prefix); > > + } else { > > + log.debug("Sampler name naming mode not > recognized"); > > + } > > } else { > > sampler.setName(incrementRequestNumberAndGet() + " " + > > sampler.getPath()); > > } > > } else { > > if(!StringUtils.isEmpty(prefix)) { > > - sampler.setName(prefix); > > + if (HttpSampleNameMode==SAMPLER_ > NAME_NAMING_MODE_PREFIX) > > { > > + sampler.setName(prefix+sampler.getPath()); > > + } else if (HttpSampleNameMode==SAMPLER_ > NAME_NAMING_MODE_COMPLETE) > > { > > + sampler.setName(prefix); > > + } else { > > + log.debug("Sampler name naming mode not > recognized"); > > + } > > } else { > > sampler.setName(sampler.getPath()); > > } > > > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/HttpRequestHdr.java > > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ > > http/org/apache/jmeter/protocol/http/proxy/HttpRequestHdr.java?rev= > > 1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/HttpRequestHdr.java > > (original) > > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/HttpRequestHdr.java > > Sat Nov 11 20:49:03 2017 > > @@ -88,6 +88,8 @@ public class HttpRequestHdr { > > private String firstLine; // saved copy of first line for error > > reports > > > > private String prefix; > > + > > + private int httpSampleNameMode; > > > > public HttpRequestHdr() { > > this("", ""); > > @@ -105,12 +107,22 @@ public class HttpRequestHdr { > > * @param httpSamplerName the http sampler name > > */ > > public HttpRequestHdr(String prefix, String httpSamplerName) { > > - this.prefix = prefix; > > - this.httpSamplerName = httpSamplerName; > > - this.firstLine = "" ; // $NON-NLS-1$ > > + this(prefix, httpSamplerName,0); > > } > > > > /** > > + * @param prefix Sampler prefix > > + * @param httpSamplerName the http sampler name > > + * @param httpSampleNameMode the naming mode of sampler name > > + */ > > + public HttpRequestHdr(String prefix, String httpSamplerName, int > > httpSampleNameMode) { > > + this.prefix = prefix; > > + this.httpSamplerName = httpSamplerName; > > + this.firstLine = "" ; // $NON-NLS-1$ > > + this.httpSampleNameMode = httpSampleNameMode; > > + } > > + > > + /** > > * Parses a http header from a stream. > > * > > * @param in > > @@ -457,4 +469,11 @@ public class HttpRequestHdr { > > public String getPrefix() { > > return prefix; > > } > > + > > + /** > > + * @return the httpSampleNameMode > > + */ > > + public int getHttpSampleNameMode() { > > + return httpSampleNameMode; > > + } > > } > > > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/Proxy.java > > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ > > http/org/apache/jmeter/protocol/http/proxy/Proxy. > > java?rev=1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/Proxy.java > > (original) > > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/Proxy.java > > Sat Nov 11 20:49:03 2017 > > @@ -161,8 +161,8 @@ public class Proxy extends Thread { > > public void run() { > > // Check which HTTPSampler class we should use > > String httpSamplerName = target.getSamplerTypeName(); > > - > > - HttpRequestHdr request = new HttpRequestHdr(target. > getPrefixHTTPSampleName(), > > httpSamplerName); > > + > > + HttpRequestHdr request = new HttpRequestHdr(target. > getPrefixHTTPSampleName(), > > httpSamplerName,target.getHTTPSampleNamingMode()); > > SampleResult result = null; > > HeaderManager headers = null; > > HTTPSamplerBase sampler = null; > > > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/ProxyControl.java > > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ > > http/org/apache/jmeter/protocol/http/proxy/ > ProxyControl.java?rev=1814971& > > r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/ProxyControl.java > > (original) > > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/ > protocol/http/proxy/ProxyControl.java > > Sat Nov 11 20:49:03 2017 > > @@ -156,6 +156,8 @@ public class ProxyControl extends Generi > > > > private static final String SAMPLER_DOWNLOAD_IMAGES = > > "ProxyControlGui.sampler_download_images"; // $NON-NLS-1$ > > > > + private static final String HTTP_SAMPLER_NAMING_MODE = > > "ProxyControlGui.proxy_http_sampler_naming_mode"; // $NON-NLS-1$ > > + > > private static final String PREFIX_HTTP_SAMPLER_NAME = > > "ProxyControlGui.proxy_prefix_http_sampler_name"; // $NON-NLS-1$ > > > > private static final String PROXY_PAUSE_HTTP_SAMPLER = > > "ProxyControlGui.proxy_pause_http_sampler"; // $NON-NLS-1$ > > @@ -181,6 +183,7 @@ public class ProxyControl extends Generi > > private static final int GROUPING_STORE_FIRST_ONLY = 3; > > private static final int GROUPING_IN_TRANSACTION_CONTROLLERS = 4; > > > > + > > // Original numeric order (we now use strings) > > private static final String SAMPLER_TYPE_HTTP_SAMPLER_JAVA = "0"; > > private static final String SAMPLER_TYPE_HTTP_SAMPLER_HC3_1 = "1"; > > @@ -389,6 +392,10 @@ public class ProxyControl extends Generi > > setProperty(new BooleanProperty(SAMPLER_DOWNLOAD_IMAGES, b)); > > } > > > > + public void setHTTPSampleNamingMode(int HTTPNamingMode) { > > + setProperty(new IntegerProperty(HTTP_SAMPLER_NAMING_MODE, > > HTTPNamingMode)); > > + } > > + > > public void setPrefixHTTPSampleName(String prefixHTTPSampleName) { > > setProperty(PREFIX_HTTP_SAMPLER_NAME, prefixHTTPSampleName); > > } > > @@ -479,6 +486,10 @@ public class ProxyControl extends Generi > > return getPropertyAsBoolean(SAMPLER_DOWNLOAD_IMAGES, false); > > } > > > > + public int getHTTPSampleNamingMode() { > > + return getPropertyAsInt(HTTP_SAMPLER_NAMING_MODE); > > + } > > + > > public String getPrefixHTTPSampleName() { > > return getPropertyAsString(PREFIX_HTTP_SAMPLER_NAME); > > } > > > > Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/gui/ProxyControlGui.java > > URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/ > > http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev= > > 1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/gui/ProxyControlGui.java (original) > > +++ jmeter/trunk/src/protocol/http/org/apache/jmeter/ > > protocol/http/proxy/gui/ProxyControlGui.java Sat Nov 11 20:49:03 2017 > > @@ -157,7 +157,12 @@ public class ProxyControlGui extends Log > > private JCheckBox samplerDownloadImages; > > > > /** > > - * Add a prefix to HTTP sample name recorded > > + * To choose between a prefix or a transaction name > > + */ > > + private JComboBox<String> HTTPSampleNamingMode; > > + > > + /** > > + * Add a prefix/transaction name to HTTP sample name recorded > > */ > > private JTextField prefixHTTPSampleName; > > > > @@ -227,6 +232,8 @@ public class ProxyControlGui extends Log > > private static final String ADD_TO_EXCLUDE_FROM_CLIPBOARD = > > "exclude_clipboard"; // $NON-NLS-1$ > > > > private static final String ADD_SUGGESTED_EXCLUDES = > > "exclude_suggested"; > > + > > + private static final String HTTP_SAMPLER_NAMING_MODE = > > "proxy_http_sampler_naming_mode"; // $NON-NLS-1$ > > > > private static final String PREFIX_HTTP_SAMPLER_NAME = > > "proxy_prefix_http_sampler_name"; // $NON-NLS-1$ > > > > @@ -284,6 +291,7 @@ public class ProxyControlGui extends Log > > model.setSamplerFollowRedirects(samplerFollowRedirects. > > isSelected()); > > model.setUseKeepAlive(useKeepAlive.isSelected()); > > model.setSamplerDownloadImages(samplerDownloadImages. > > isSelected()); > > + model.setHTTPSampleNamingMode(HTTPSampleNamingMode. > > getSelectedIndex()); > > model.setPrefixHTTPSampleName( > prefixHTTPSampleName.getText() > > ); > > model.setProxyPauseHTTPSample( > proxyPauseHTTPSample.getText() > > ); > > model.setNotifyChildSamplerListenerOfFilteredSamplers( > > notifyChildSamplerListenerOfFilteredSamplersCB.isSelected()); > > @@ -346,6 +354,7 @@ public class ProxyControlGui extends Log > > samplerFollowRedirects.setSelected(model. > > getSamplerFollowRedirects()); > > useKeepAlive.setSelected(model.getUseKeepalive()); > > samplerDownloadImages.setSelected(model. > > getSamplerDownloadImages()); > > + HTTPSampleNamingMode.setSelectedIndex(model. > > getHTTPSampleNamingMode()); > > prefixHTTPSampleName.setText(model.getPrefixHTTPSampleName()); > > proxyPauseHTTPSample.setText(model.getProxyPauseHTTPSample()); > > notifyChildSamplerListenerOfFilteredSamplersCB.setSelected( > model. > > getNotifyChildSamplerListenerOfFilteredSamplers()); > > @@ -375,10 +384,18 @@ public class ProxyControlGui extends Log > > * Also handles samplerTypeName > > */ > > /** {@inheritDoc} */ > > - @Override > > - public void itemStateChanged(ItemEvent e) { > > - enableRestart(); > > - } > > + @Override > > + public void itemStateChanged(ItemEvent e) { > > + if (e.getSource() instanceof JComboBox) { > > + JComboBox combo = (JComboBox) e.getSource(); > > + if(HTTP_SAMPLER_NAMING_MODE. > > equals(combo.getName())){ > > + model.setHTTPSampleNamingMode( > > HTTPSampleNamingMode.getSelectedIndex()); > > + } > > + } > > + else { > > + enableRestart(); > > + } > > + } > > > > /** {@inheritDoc} */ > > @Override > > @@ -834,12 +851,16 @@ public class ProxyControlGui extends Log > > samplerDownloadImages.addActionListener(this); > > samplerDownloadImages.setActionCommand(ENABLE_RESTART); > > > > + DefaultComboBoxModel<String> choice = new > > DefaultComboBoxModel<>(); > > + choice.addElement(JMeterUtils.getResString("sample_name_ > prefix")); > > // $NON-NLS-1$ > > + choice.addElement(JMeterUtils.getResString("sample_name_ > transaction")); > > // $NON-NLS-1$ > > + HTTPSampleNamingMode = new JComboBox<>(choice); > > > > I think you should rename this variable to follow instance variable naming > convention. > Thank you > > + HTTPSampleNamingMode.setName(HTTP_SAMPLER_NAMING_MODE); > > + HTTPSampleNamingMode.addItemListener(this); > > + > > prefixHTTPSampleName = new JTextField(4); > > prefixHTTPSampleName.addKeyListener(this); > > prefixHTTPSampleName.setName(PREFIX_HTTP_SAMPLER_NAME); > > - prefixHTTPSampleName.setActionCommand(ENABLE_RESTART); > > - JLabel labelPrefix = new JLabel(JMeterUtils. > > getResString("proxy_prefix_http_sampler_name")); // $NON-NLS-1$ > > - labelPrefix.setLabelFor(prefixHTTPSampleName); > > > > proxyPauseHTTPSample = new JTextField(6); > > proxyPauseHTTPSample.addKeyListener(this); > > @@ -853,7 +874,7 @@ public class ProxyControlGui extends Log > > > > GridBagLayout gridBagLayout = new GridBagLayout(); > > GridBagConstraints gbc = new GridBagConstraints(); > > - gbc.anchor = GridBagConstraints.NORTHWEST; > > + gbc.anchor = GridBagConstraints.FIRST_LINE_START; > > gbc.fill = GridBagConstraints.NONE; > > gbc.gridheight = 1; > > gbc.gridwidth = 1; > > @@ -864,7 +885,7 @@ public class ProxyControlGui extends Log > > JPanel panel = new JPanel(gridBagLayout); > > panel.setBorder(BorderFactory.createTitledBorder(BorderFactory. > > createEtchedBorder(), > > JMeterUtils.getResString("proxy_sampler_settings"))); > // > > $NON-NLS-1$ > > - panel.add(labelPrefix, gbc.clone()); > > + panel.add(HTTPSampleNamingMode, gbc.clone()); > > gbc.gridx++; > > gbc.weightx = 3; > > gbc.fill=GridBagConstraints.HORIZONTAL; > > > > Modified: jmeter/trunk/xdocs/changes.xml > > URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes. > > xml?rev=1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/xdocs/changes.xml [utf-8] (original) > > +++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Nov 11 20:49:03 2017 > > @@ -90,7 +90,7 @@ Summary > > <ul> > > <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>61672</bug>HTTP(S) Test Script Recorder : Have the ability > > to choose the sampler name while keeping the ability to just add a > > prefix</li> > > <li><bug>53957</bug>HTTP Request : In Parameters tab, allow pasting > > of content coming from Firefox and Chrome (unparsed)</li> > > <li><bug>61587</bug>Drop properties <code>sampleresult.getbytes. > headers_size</code> > > and <code>sampleresult.getbytes.body_real_size</code></li> > > </ul> > > > > Modified: jmeter/trunk/xdocs/images/screenshots/proxy_control.png > > URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/images/ > > screenshots/proxy_control.png?rev=1814971&r1=1814970&r2= > 1814971&view=diff > > ============================================================ > > ================== > > Binary files - no diff available. > > > > Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml > > URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/ > > component_reference.xml?rev=1814971&r1=1814970&r2=1814971&view=diff > > ============================================================ > > ================== > > --- jmeter/trunk/xdocs/usermanual/component_reference.xml (original) > > +++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Nov 11 > > 20:49:03 2017 > > @@ -6646,6 +6646,7 @@ Both Chrome and Internet Explorer use th > > </property> > > <property name="Add Assertions" required="Yes">Add a blank > > assertion to each sampler?</property> > > <property name="Regex Matching" required="Yes">Use Regex > Matching > > when replacing variables? If checked replacement will use word > boundaries, > > i.e. it will only replace word matching values of variable, not part of a > > word. A word boundary follows Perl5 definition and is equivalent to > > <code>\b</code>. More information below in the paragraph about > "<code>User > > Defined Variable replacement</code>".</property> > > + <property name="Prefix/Transaction name" required="No">Add a > > prefix to sampler name during recording (Prefix mode). Or replace sampler > > name by user choosen name (Transaction name)</property> > > <property name="Type" required="Yes">Which type of sampler to > > generate (the HTTPClient default or Java)</property> > > <property name="Redirect Automatically" required="Yes">Set > > Redirect Automatically in the generated samplers?</property> > > <property name="Follow Redirects" required="Yes">Set Follow > > Redirects in the generated samplers?<br/> > > > > > > > > > -- > Cordialement. > Philippe Mouawad. >
