Author: pmouawad
Date: Fri Mar 4 22:16:39 2016
New Revision: 1733665
URL: http://svn.apache.org/viewvc?rev=1733665&view=rev
Log:
Bug 59116 - Add the possibility to setup a prefix to sampler name recorded by
proxy
#resolve #158
Fixed the following in PR:
- SampleResult did not match the modified Sample label
- Added code in keyListener to ensure the model is updated, otherwise the
ProxyControl would still use old prefix until user leaves the component
- French label
Bugzilla Id: 59116
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/ProxyControl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.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=1733665&r1=1733664&r2=1733665&view=diff
==============================================================================
--- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
(original)
+++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Fri
Mar 4 22:16:39 2016
@@ -767,6 +767,7 @@ proxy_domains_dynamic_mode_tooltip=List
proxy_domains_dynamic_mode_tooltip_java6=To activate this field, use a Java 7+
runtime environment
proxy_general_settings=Global Settings
proxy_headers=Capture HTTP Headers
+proxy_prefix_http_sampler_name=Prefix\:
proxy_regex=Regex matching
proxy_sampler_settings=HTTP Sampler settings
proxy_sampler_type=Type\:
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=1733665&r1=1733664&r2=1733665&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 Mar 4 22:16:39 2016
@@ -752,6 +752,7 @@ proxy_domains_dynamic_mode_tooltip=Liste
proxy_domains_dynamic_mode_tooltip_java6=Pour activer ce champ, utiliser un
environnement d'ex\u00E9cution Java 7+
proxy_general_settings=Param\u00E8tres g\u00E9n\u00E9raux
proxy_headers=Capturer les ent\u00EAtes HTTP
+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 \:
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=1733665&r1=1733664&r2=1733665&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
Fri Mar 4 22:16:39 2016
@@ -44,6 +44,7 @@ import org.apache.commons.codec.binary.B
import org.apache.commons.codec.digest.DigestUtils;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.RandomStringUtils;
+import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.time.DateUtils;
import org.apache.http.conn.ssl.AbstractVerifier;
import org.apache.jmeter.assertions.ResponseAssertion;
@@ -151,6 +152,8 @@ public class ProxyControl extends Generi
private static final String USE_KEEPALIVE =
"ProxyControlGui.use_keepalive"; // $NON-NLS-1$
private static final String SAMPLER_DOWNLOAD_IMAGES =
"ProxyControlGui.sampler_download_images"; // $NON-NLS-1$
+
+ private static final String PREFIX_HTTP_SAMPLER_NAME =
"ProxyControlGui.proxy_prefix_http_sampler_name"; // $NON-NLS-1$
private static final String REGEX_MATCH = "ProxyControlGui.regex_match";
// $NON-NLS-1$
@@ -358,6 +361,10 @@ public class ProxyControl extends Generi
setProperty(new BooleanProperty(SAMPLER_DOWNLOAD_IMAGES, b));
}
+ public void setPrefixHTTPSampleName(String prefixHTTPSampleName) {
+ setProperty(PREFIX_HTTP_SAMPLER_NAME, prefixHTTPSampleName);
+ }
+
public void setNotifyChildSamplerListenerOfFilteredSamplers(boolean b) {
notifyChildSamplerListenersOfFilteredSamples = b;
setProperty(new
BooleanProperty(NOTIFY_CHILD_SAMPLER_LISTENERS_FILTERED, b));
@@ -440,6 +447,10 @@ public class ProxyControl extends Generi
return getPropertyAsBoolean(SAMPLER_DOWNLOAD_IMAGES, false);
}
+ public String getPrefixHTTPSampleName() {
+ return getPropertyAsString(PREFIX_HTTP_SAMPLER_NAME);
+ }
+
public boolean getNotifyChildSamplerListenerOfFilteredSamplers() {
return getPropertyAsBoolean(NOTIFY_CHILD_SAMPLER_LISTENERS_FILTERED,
true);
}
@@ -569,7 +580,11 @@ public class ProxyControl extends Generi
sampler.setFollowRedirects(samplerFollowRedirects);
sampler.setUseKeepAlive(useKeepAlive);
sampler.setImageParser(samplerDownloadImages);
-
+ String prefix = getPrefixHTTPSampleName();
+ if(!StringUtils.isEmpty(prefix)) {
+ sampler.setName(prefix + sampler.getName());
+ result.setSampleLabel(prefix + result.getSampleLabel());
+ }
Authorization authorization = createAuthorization(subConfigs,
sampler);
if (authorization != null) {
setAuthorization(authorization, myTarget);
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=1733665&r1=1733664&r2=1733665&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
Fri Mar 4 22:16:39 2016
@@ -151,6 +151,11 @@ public class ProxyControlGui extends Log
private JCheckBox samplerDownloadImages;
/**
+ * Add a prefix to HTTP sample name recorded
+ */
+ private JTextField prefixHTTPSampleName;
+
+ /**
* Regular expression to include results based on content type
*/
private JTextField contentTypeInclude;
@@ -209,6 +214,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 PREFIX_HTTP_SAMPLER_NAME =
"proxy_prefix_http_sampler_name"; // $NON-NLS-1$
//- action names
// Resource names for column headers
@@ -263,6 +270,7 @@ public class ProxyControlGui extends Log
model.setSamplerFollowRedirects(samplerFollowRedirects.isSelected());
model.setUseKeepAlive(useKeepAlive.isSelected());
model.setSamplerDownloadImages(samplerDownloadImages.isSelected());
+ model.setPrefixHTTPSampleName(prefixHTTPSampleName.getText());
model.setNotifyChildSamplerListenerOfFilteredSamplers(notifyChildSamplerListenerOfFilteredSamplersCB.isSelected());
model.setRegexMatch(regexMatch.isSelected());
model.setContentTypeInclude(contentTypeInclude.getText());
@@ -323,6 +331,7 @@ public class ProxyControlGui extends Log
samplerFollowRedirects.setSelected(model.getSamplerFollowRedirects());
useKeepAlive.setSelected(model.getUseKeepalive());
samplerDownloadImages.setSelected(model.getSamplerDownloadImages());
+ prefixHTTPSampleName.setText(model.getPrefixHTTPSampleName());
notifyChildSamplerListenerOfFilteredSamplersCB.setSelected(model.getNotifyChildSamplerListenerOfFilteredSamplers());
regexMatch.setSelected(model.getRegexMatch());
contentTypeInclude.setText(model.getContentTypeInclude());
@@ -586,6 +595,8 @@ public class ProxyControlGui extends Log
enableRestart();
} else if (fieldName.equals(ENABLE_RESTART)){
enableRestart();
+ } else if(fieldName.equals(PREFIX_HTTP_SAMPLER_NAME)) {
+ model.setPrefixHTTPSampleName(prefixHTTPSampleName.getText());
}
}
@@ -739,11 +750,21 @@ public class ProxyControlGui extends Log
samplerDownloadImages.addActionListener(this);
samplerDownloadImages.setActionCommand(ENABLE_RESTART);
+ prefixHTTPSampleName = new JTextField(4);
+ prefixHTTPSampleName.addKeyListener(this);
+ prefixHTTPSampleName.setName(PREFIX_HTTP_SAMPLER_NAME);
+ // TODO Not sure this is needed
+ prefixHTTPSampleName.setActionCommand(ENABLE_RESTART);
+ JLabel labelPrefix = new
JLabel(JMeterUtils.getResString("proxy_prefix_http_sampler_name")); //
$NON-NLS-1$
+ labelPrefix.setLabelFor(prefixHTTPSampleName);
+
HorizontalPanel panel = new HorizontalPanel();
panel.setBorder(BorderFactory.createTitledBorder(BorderFactory.createEtchedBorder(),
JMeterUtils.getResString("proxy_sampler_settings"))); //
$NON-NLS-1$
panel.add(label2);
panel.add(samplerTypeName);
+ panel.add(labelPrefix);
+ panel.add(prefixHTTPSampleName);
panel.add(samplerRedirectAutomatically);
panel.add(samplerFollowRedirects);
panel.add(useKeepAlive);
Modified: jmeter/trunk/xdocs/changes.xml
URL:
http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1733665&r1=1733664&r2=1733665&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Fri Mar 4 22:16:39 2016
@@ -134,6 +134,7 @@ Summary
<li><bug>59103</bug>HTTP Request Java Implementation: Change default
"http.java.sampler.retries" to align it on HttpClient behaviour and make it
meaningful</li>
<li><bug>59083</bug>HTTP Request : Make Method field editable so that
additional methods (Webdav) can be added easily</li>
<li><bug>59118</bug>Add comment in recorded think time by proxy recorder.
Contributed by Antonio Gomes Rodrigues (ra0077 at gmail.com)</li>
+ <li><bug>59116</bug>Add the possibility to setup a prefix to sampler name
recorded by proxy. Partly based on a patch by Antonio Gomes Rodrigues (ra0077
at gmail.com)</li>
</ul>
<h3>Other samplers</h3>