You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jmeter-dev@jakarta.apache.org by se...@apache.org on 2007/03/17 19:50:24 UTC

svn commit: r519406 - in /jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy: Proxy.java ProxyControl.java

Author: sebb
Date: Sat Mar 17 11:50:23 2007
New Revision: 519406

URL: http://svn.apache.org/viewvc?view=rev&rev=519406
Log:
Allow Proxy to work with HTTPSampler2

Modified:
    jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
    jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java

Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java?view=diff&rev=519406&r1=519405&r2=519406
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/Proxy.java Sat Mar 17 11:50:23 2007
@@ -121,6 +121,7 @@
 			if (httpsSpoof) {
 				sampler.setProtocol("https");
 			}
+			sampler.threadStarted(); // Needed for HTTPSampler2
 			result = sampler.sample();
 			
 			/*
@@ -154,6 +155,7 @@
 			} catch (Exception e) {
 				log.error("", e);
 			}
+			sampler.threadFinished(); // Needed for HTTPSampler2
 		}
 	}
 

Modified: jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java?view=diff&rev=519406&r1=519405&r2=519406
==============================================================================
--- jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java (original)
+++ jakarta/jmeter/branches/rel-2-2/src/protocol/http/org/apache/jmeter/protocol/http/proxy/ProxyControl.java Sat Mar 17 11:50:23 2007
@@ -41,7 +41,9 @@
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.protocol.http.control.RecordingController;
 import org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui;
+import org.apache.jmeter.protocol.http.control.gui.HttpTestSampleGui2;
 import org.apache.jmeter.protocol.http.gui.HeaderPanel;
+import org.apache.jmeter.protocol.http.sampler.HTTPSampler2;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.samplers.SampleEvent;
 import org.apache.jmeter.samplers.SampleListener;
@@ -74,10 +76,10 @@
     private static final Logger log = LoggingManager.getLoggerForClass();
 
     /*
-     * Use class names so the complier can detect if a class is renamed/deleted
+     * Use class names so the compiler can detect if a class is renamed/deleted
      */
-    //  TODO - allow for HttpClient sampler ...
 	private static final String HTTP_TEST_SAMPLE_GUI = HttpTestSampleGui.class.getName();
+	private static final String HTTP_TEST_SAMPLE_GUI2 = HttpTestSampleGui2.class.getName();
 
     private static final String ASSERTION_GUI = AssertionGui.class.getName();
 
@@ -201,7 +203,7 @@
 	}
 	
 	public String getClassLabel() {
-		return JMeterUtils.getResString("proxy_title");
+		return JMeterUtils.getResString("proxy_title"); // $NON-NLS-1$
 	}
 
 	public boolean getAssertions() {
@@ -308,7 +310,11 @@
 			removeValuesFromSampler(sampler, defaultConfigurations);
 			replaceValues(sampler, subConfigs, userDefinedVariables);
 			sampler.setUseKeepAlive(useKeepAlive);
-			sampler.setProperty(TestElement.GUI_CLASS, HTTP_TEST_SAMPLE_GUI);
+			
+			sampler.setProperty(TestElement.GUI_CLASS, 
+					(sampler instanceof HTTPSampler2) ?
+					HTTP_TEST_SAMPLE_GUI2 : HTTP_TEST_SAMPLE_GUI
+					);
 
 			placeSampler(sampler, subConfigs, myTarget);
 
@@ -406,7 +412,7 @@
 	 */
 	private void addTimers(JMeterTreeModel model, JMeterTreeNode node, long deltaT) {
 		TestPlan variables = new TestPlan();
-		variables.addParameter("T", Long.toString(deltaT));
+		variables.addParameter("T", Long.toString(deltaT)); // $NON-NLS-1$
 		ValueReplacer replacer = new ValueReplacer(variables);
 		JMeterTreeNode mySelf = model.getNodeOf(this);
 		Enumeration children = mySelf.children();
@@ -664,11 +670,11 @@
 
 	private String generateMatchUrl(HTTPSamplerBase sampler) {
 		StringBuffer buf = new StringBuffer(sampler.getDomain());
-		buf.append(':');
+		buf.append(':'); // $NON-NLS-1$
 		buf.append(sampler.getPort());
 		buf.append(sampler.getPath());
 		if (sampler.getQueryString().length() > 0) {
-			buf.append('?');
+			buf.append('?'); // $NON-NLS-1$
 			buf.append(sampler.getQueryString());
 		}
 		return buf.toString();



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