You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jakarta.apache.org by se...@apache.org on 2010/12/02 14:25:36 UTC
svn commit: r1041371 - in /jakarta/jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/proxy/
src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ xdocs/
Author: sebb
Date: Thu Dec 2 13:25:36 2010
New Revision: 1041371
URL: http://svn.apache.org/viewvc?rev=1041371&view=rev
Log:
Fix JMeter Proxy to use new HTTP implementation names
Modified:
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
jakarta/jmeter/trunk/xdocs/changes.xml
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?rev=1041371&r1=1041370&r2=1041371&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Thu Dec 2 13:25:36 2010
@@ -175,13 +175,7 @@ public class Proxy extends Thread {
@Override
public void run() {
// Check which HTTPSampler class we should use
- String httpSamplerName = HTTPSamplerFactory.DEFAULT_CLASSNAME;
- if(target.getSamplerTypeName() == ProxyControl.SAMPLER_TYPE_HTTP_SAMPLER) {
- httpSamplerName = HTTPSamplerFactory.HTTP_SAMPLER_JAVA;
- }
- else if(target.getSamplerTypeName() == ProxyControl.SAMPLER_TYPE_HTTP_SAMPLER2) {
- httpSamplerName = HTTPSamplerFactory.HTTP_SAMPLER_APACHE;
- }
+ String httpSamplerName = target.getSamplerTypeName();
// Instantiate the sampler
HTTPSamplerBase sampler = HTTPSamplerFactory.newInstance(httpSamplerName);
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?rev=1041371&r1=1041370&r2=1041371&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java Thu Dec 2 13:25:36 2010
@@ -46,6 +46,7 @@ import org.apache.jmeter.protocol.http.c
import org.apache.jmeter.protocol.http.control.RecordingController;
import org.apache.jmeter.protocol.http.gui.HeaderPanel;
import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
import org.apache.jmeter.samplers.SampleEvent;
import org.apache.jmeter.samplers.SampleListener;
import org.apache.jmeter.samplers.SampleResult;
@@ -138,10 +139,9 @@ public class ProxyControl extends Generi
private static final int GROUPING_STORE_FIRST_ONLY = 3;
private static final int GROUPING_IN_TRANSACTION_CONTROLLERS = 4;
- // Must agree with the order of entries in the drop-down
- // created in ProxyControlGui.createHTTPSamplerPanel()
- public static final int SAMPLER_TYPE_HTTP_SAMPLER = 0;
- public static final int SAMPLER_TYPE_HTTP_SAMPLER2 = 1;
+ // Original numeric order (we now use strings)
+ private static final String SAMPLER_TYPE_HTTP_SAMPLER = "0";
+ private static final String SAMPLER_TYPE_HTTP_SAMPLER2 = "1";
private long lastTime = 0;// When was the last sample seen?
@@ -282,8 +282,15 @@ public class ProxyControl extends Generi
return getPropertyAsBoolean(CAPTURE_HTTP_HEADERS);
}
- public int getSamplerTypeName() {
- return getPropertyAsInt(SAMPLER_TYPE_NAME);
+ public String getSamplerTypeName() {
+ // Convert the old numeric types - just in case someone wants to reload the workbench
+ String type = getPropertyAsString(SAMPLER_TYPE_NAME);
+ if (SAMPLER_TYPE_HTTP_SAMPLER.equals(type)){
+ type = HTTPSamplerFactory.IMPL_JAVA;
+ } else if (SAMPLER_TYPE_HTTP_SAMPLER2.equals(type)){
+ type = HTTPSamplerFactory.IMPL_HTTP_CLIENT3_1;
+ }
+ return type;
}
public boolean getSamplerRedirectAutomatically() {
Modified: jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java?rev=1041371&r1=1041370&r2=1041371&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java (original)
+++ jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/proxy/gui/ProxyControlGui.java Thu Dec 2 13:25:36 2010
@@ -60,6 +60,7 @@ import org.apache.jmeter.gui.util.MenuFa
import org.apache.jmeter.gui.util.PowerTableModel;
import org.apache.jmeter.gui.util.VerticalPanel;
import org.apache.jmeter.protocol.http.proxy.ProxyControl;
+import org.apache.jmeter.protocol.http.sampler.HTTPSamplerFactory;
import org.apache.jmeter.testelement.TestElement;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jmeter.testelement.WorkBench;
@@ -291,7 +292,7 @@ public class ProxyControlGui extends Log
httpHeaders.setSelected(model.getCaptureHttpHeaders());
groupingMode.setSelectedIndex(model.getGroupingMode());
addAssertions.setSelected(model.getAssertions());
- samplerTypeName.setSelectedIndex(model.getSamplerTypeName());
+ samplerTypeName.setSelectedItem(model.getSamplerTypeName());
samplerRedirectAutomatically.setSelected(model.getSamplerRedirectAutomatically());
samplerFollowRedirects.setSelected(model.getSamplerFollowRedirects());
useKeepAlive.setSelected(model.getUseKeepalive());
@@ -561,10 +562,9 @@ public class ProxyControlGui extends Log
private JPanel createHTTPSamplerPanel() {
DefaultComboBoxModel m = new DefaultComboBoxModel();
- // Note: position of these elements in the menu *must* match the
- // corresponding ProxyControl.SAMPLER_TYPE_* values.
- m.addElement(JMeterUtils.getResString("web_testing_title")); // $NON-NLS-1$
- m.addElement(JMeterUtils.getResString("web_testing2_title")); // $NON-NLS-1$
+ for (String s : HTTPSamplerFactory.getImplementations()){
+ m.addElement(s);
+ }
samplerTypeName = new JComboBox(m);
samplerTypeName.setSelectedIndex(0);
samplerTypeName.addItemListener(this);
Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=1041371&r1=1041370&r2=1041371&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Dec 2 13:25:36 2010
@@ -66,6 +66,11 @@ Removed method public static long curren
This has been replaced by the instance method public long currentTimeInMillis().
</p>
+<p>
+ProxyControl.getSamplerTypeName() now returns a String rather than an int.
+This is internal to the workings of the JMeter Proxy & its GUI, so should not affect any user code.
+</p>
+
<h2>Bug fixes</h2>
<h3>HTTP Samplers and Proxy</h3>
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@jakarta.apache.org
For additional commands, e-mail: notifications-help@jakarta.apache.org