You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2012/06/23 17:26:37 UTC

svn commit: r1353144 - in /jmeter/trunk/test/src/org/apache/jmeter/protocol/http: config/ control/ modifier/ proxy/ sampler/

Author: sebb
Date: Sat Jun 23 15:26:36 2012
New Revision: 1353144

URL: http://svn.apache.org/viewvc?rev=1353144&view=rev
Log:
Standardise on HTTPConstants, not the interface

Modified:
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java
    jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/config/UrlConfigTest.java Sat Jun 23 15:26:36 2012
@@ -22,6 +22,7 @@ import org.apache.jmeter.config.Argument
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.testelement.property.JMeterProperty;
 import org.apache.jmeter.testelement.property.NullProperty;
 import org.apache.jmeter.testelement.property.TestElementProperty;
@@ -47,7 +48,7 @@ public class UrlConfigTest extends JMete
         config.setName("Full Config");
         config.setProperty(HTTPSamplerBase.DOMAIN, "www.lazer.com");
         config.setProperty(HTTPSamplerBase.PATH, "login.jsp");
-        config.setProperty(HTTPSamplerBase.METHOD, HTTPSamplerBase.POST);
+        config.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.POST);
         config.setProperty(new TestElementProperty(HTTPSamplerBase.ARGUMENTS, args));
         defaultConfig = new HTTPNullSampler();
         defaultConfig.setName("default");
@@ -55,7 +56,7 @@ public class UrlConfigTest extends JMete
         defaultConfig.setProperty(HTTPSamplerBase.PATH, "default.html");
         partialConfig = new HTTPNullSampler();
         partialConfig.setProperty(HTTPSamplerBase.PATH, "main.jsp");
-        partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPSamplerBase.GET);
+        partialConfig.setProperty(HTTPSamplerBase.METHOD, HTTPConstants.GET);
     }
 
     public void testSimpleConfig() {

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCookieManager.java Sat Jun 23 15:26:36 2012
@@ -24,6 +24,7 @@ import org.apache.commons.httpclient.coo
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
 
@@ -67,7 +68,7 @@ public class TestCookieManager extends J
             HTTPSamplerBase sampler = new HTTPNullSampler();
             sampler.setDomain("jakarta.apache.org");
             sampler.setPath("/index.html");
-            sampler.setMethod(HTTPSamplerBase.GET);
+            sampler.setMethod(HTTPConstants.GET);
             assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
         }
 
@@ -76,7 +77,7 @@ public class TestCookieManager extends J
             HTTPSamplerBase sampler = new HTTPNullSampler();
             sampler.setDomain("jakarta.apache.org");
             sampler.setPath("/index.html");
-            sampler.setMethod(HTTPSamplerBase.GET);
+            sampler.setMethod(HTTPConstants.GET);
             assertNotNull(man.getCookieHeaderForURL(sampler.getUrl()));
         }
 

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestAnchorModifier.java Sat Jun 23 15:26:36 2012
@@ -27,6 +27,7 @@ import org.apache.jmeter.junit.JMeterTes
 import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
 import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.save.SaveService;
 import org.apache.jmeter.threads.JMeterContext;
 import org.apache.jmeter.threads.JMeterContextService;
@@ -115,8 +116,8 @@ public class TestAnchorModifier extends 
         // Test https works too
         public void testSimpleParse1() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*/index\\.html");
-            config.setProtocol(HTTPSamplerBase.PROTOCOL_HTTPS);
-            config.setPort(HTTPSamplerBase.DEFAULT_HTTPS_PORT);
+            config.setProtocol(HTTPConstants.PROTOCOL_HTTPS);
+            config.setPort(HTTPConstants.DEFAULT_HTTPS_PORT);
             HTTPSamplerBase context = makeContext("https://www.apache.org/subdir/previous.html");
             String responseText = "<html><head><title>Test page</title></head><body>"
                     + "<a href=\"index.html\">Goto index page</a></body></html>";
@@ -257,7 +258,7 @@ public class TestAnchorModifier extends 
         public void testSimpleFormParse() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.html");
             config.addArgument("test", "g.*");
-            config.setMethod(HTTPSamplerBase.POST);
+            config.setMethod(HTTPConstants.POST);
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
             String responseText = "<html><head><title>Test page</title></head><body>"
                     + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"test\""
@@ -277,7 +278,7 @@ public class TestAnchorModifier extends 
         public void testBadCharParse() throws Exception {
             HTTPSamplerBase config = makeUrlConfig(".*index.html");
             config.addArgument("te$st", "g.*");
-            config.setMethod(HTTPSamplerBase.POST);
+            config.setMethod(HTTPConstants.POST);
             HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
             String responseText = "<html><head><title>Test page</title></head><body>"
                     + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"checkbox\" name=\"te$st\""
@@ -300,7 +301,7 @@ public class TestAnchorModifier extends 
         
         HTTPSamplerBase config = makeUrlConfig(".*index.html");
         config.addArgument("test", ".*");
-        config.setMethod(HTTPSamplerBase.POST);
+        config.setMethod(HTTPConstants.POST);
         HTTPSamplerBase context = makeContext("http://www.apache.org/subdir/previous.html");
         String responseText = "<html><head><title>Test page</title></head><body>"
             + "<form action=\"index.html\" method=\"POST\">" + "<input type=\"hidden\" name=\"test\""
@@ -333,10 +334,10 @@ public class TestAnchorModifier extends 
         private HTTPSamplerBase makeUrlConfig(String path) {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setDomain("www.apache.org");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.setPath(path);
-            config.setPort(HTTPSamplerBase.DEFAULT_HTTP_PORT);
-            config.setProtocol(HTTPSamplerBase.PROTOCOL_HTTP);
+            config.setPort(HTTPConstants.DEFAULT_HTTP_PORT);
+            config.setProtocol(HTTPConstants.PROTOCOL_HTTP);
             return config;
         }
 }

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/modifier/TestURLRewritingModifier.java Sat Jun 23 15:26:36 2012
@@ -23,6 +23,7 @@ import org.apache.jmeter.config.Argument
 import org.apache.jmeter.junit.JMeterTestCase;
 import org.apache.jmeter.protocol.http.sampler.HTTPNullSampler;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.samplers.NullSampler;
 import org.apache.jmeter.samplers.SampleResult;
 import org.apache.jmeter.samplers.Sampler;
@@ -88,7 +89,7 @@ public class TestURLRewritingModifier ex
             HTTPSamplerBase sampler = new HTTPNullSampler();
             sampler.setDomain("server.com");
             sampler.setPath("index.html");
-            sampler.setMethod(HTTPSamplerBase.GET);
+            sampler.setMethod(HTTPConstants.GET);
             sampler.setProtocol("http");
             return sampler;
         }

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/proxy/TestHttpRequestHdr.java Sat Jun 23 15:26:36 2012
@@ -31,6 +31,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.HeaderManager;
 import org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 
 public class TestHttpRequestHdr  extends JMeterTestCase {
@@ -47,7 +48,7 @@ public class TestHttpRequestHdr  extends
             + "?update=yes&d=1&d=2&d=&d=&d=&d=&d=&d=1&d=2&d=1&d=&d= "
             + "HTTP/1.0\r\n\r\n";
         HTTPSamplerBase s = getSamplerForRequest(url, testGetRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         Arguments arguments = s.getArguments();
@@ -71,12 +72,12 @@ public class TestHttpRequestHdr  extends
         String postBody = "update=yes&d=1&d=2&d=&d=&d=&d=&d=&d=1&d=2&d=1&d=&d=";
         String testPostRequest = "POST " + url + " HTTP/1.0\n"
                 + "Content-type: "
-                + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+                + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
                 + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
                 + "\r\n"
                 + postBody;
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertFalse(s.getDoMultipartPost());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
@@ -105,7 +106,7 @@ public class TestHttpRequestHdr  extends
                 + "\r\n"
                 + postBody;
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertFalse(s.getDoMultipartPost());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
@@ -127,7 +128,7 @@ public class TestHttpRequestHdr  extends
         // know the encoding for the page. Specify contentEncoding, so the
         // request is "sent" using that encoding
         s = getSamplerForRequest(null, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertFalse(s.getDoMultipartPost());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
@@ -158,7 +159,7 @@ public class TestHttpRequestHdr  extends
         // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
         // know the encoding for the page
         HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         assertEquals(queryString, s.getQueryString());
         assertEquals(contentEncoding, s.getContentEncoding());
 
@@ -177,7 +178,7 @@ public class TestHttpRequestHdr  extends
             + "?" + queryString
             + " HTTP/1.1\r\n\r\n";
         s = getSamplerForRequest(url, testGetRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         String expectedQueryString = "abc%3FSPACE=a+b&space=a+b&query=What%3F";
         assertEquals(expectedQueryString, s.getQueryString());
         assertEquals(contentEncoding, s.getContentEncoding());
@@ -194,14 +195,14 @@ public class TestHttpRequestHdr  extends
         String postBody = "abc%3FSPACE=a+b&space=a%20b&query=What%3F";
         String testPostRequest = "POST " + url + " HTTP/1.1\r\n"
             + "Content-type: "
-            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+            + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
             + "\r\n"
             + postBody;
         // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
         // know the encoding for the page
         s = getSamplerForRequest(null, testPostRequest, null);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(queryString, s.getQueryString());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertFalse(s.getDoMultipartPost());
@@ -219,12 +220,12 @@ public class TestHttpRequestHdr  extends
         postBody = "abc?SPACE=a+b&space=a%20b&query=What?";
         testPostRequest = "POST " + url + " HTTP/1.1\n"
             + "Content-type: "
-            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+            + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
             + "\r\n"
             + postBody;
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         expectedQueryString = "abc%3FSPACE=a+b&space=a+b&query=What%3F";
         assertEquals(expectedQueryString, s.getQueryString());
         assertEquals(contentEncoding, s.getContentEncoding());
@@ -259,7 +260,7 @@ public class TestHttpRequestHdr  extends
         // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
         // know the encoding for the page
         HTTPSamplerBase s = getSamplerForRequest(null, testGetRequest, null);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         Arguments arguments = s.getArguments();
@@ -278,7 +279,7 @@ public class TestHttpRequestHdr  extends
             + "?param1=" + param1Value + "&param2=" + param2ValueEncoded + " "
             + "HTTP/1.1\r\n\r\n";
         s = getSamplerForRequest(url, testGetRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         arguments = s.getArguments();
@@ -296,7 +297,7 @@ public class TestHttpRequestHdr  extends
             + "?param1=" + param1Value + "&param2=" + param2ValueEncoded + " "
             + "HTTP/1.1\r\n\r\n";
         s = getSamplerForRequest(url, testGetRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.GET, s.getMethod());
+        assertEquals(HTTPConstants.GET, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         arguments = s.getArguments();
@@ -316,7 +317,7 @@ public class TestHttpRequestHdr  extends
         String testPostRequest = 
             "POST " + url + " HTTP/1.1\r\n"
             + "Content-type: "
-            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+            + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
             + "\r\n"
             + postBody;
@@ -324,7 +325,7 @@ public class TestHttpRequestHdr  extends
         // Use null for url and contentEncoding, to simulate that HttpRequestHdr do not
         // know the encoding for the page
         HTTPSamplerBase s = getSamplerForRequest(null, testPostRequest, null);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         Arguments arguments = s.getArguments();
@@ -342,13 +343,13 @@ public class TestHttpRequestHdr  extends
         testPostRequest = 
             "POST " + url + " HTTP/1.1\r\n"
             + "Content-type: "
-            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+            + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
             + "\r\n"
             + postBody;
 
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         arguments = s.getArguments();
@@ -365,13 +366,13 @@ public class TestHttpRequestHdr  extends
         testPostRequest = 
             "POST " + url + " HTTP/1.1\r\n"
             + "Content-type: "
-            + HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
+            + HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED + "\r\n"
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + "\r\n"
             + "\r\n"
             + postBody;
 
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         // Check arguments
         arguments = s.getArguments();
@@ -392,7 +393,7 @@ public class TestHttpRequestHdr  extends
         String testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
 
         HTTPSamplerBase s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertTrue(s.getDoMultipartPost());
         
@@ -412,7 +413,7 @@ public class TestHttpRequestHdr  extends
         testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
 
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertTrue(s.getDoMultipartPost());
         
@@ -432,7 +433,7 @@ public class TestHttpRequestHdr  extends
         testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
 
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertTrue(s.getDoMultipartPost());
         
@@ -452,7 +453,7 @@ public class TestHttpRequestHdr  extends
         testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
 
         s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertTrue(s.getDoMultipartPost());
         
@@ -506,7 +507,7 @@ public class TestHttpRequestHdr  extends
         String testPostRequest = createMultipartFormRequest(url, postBody, contentEncoding, boundary, endOfLine);
         
         HTTPSamplerBase s = getSamplerForRequest(url, testPostRequest, contentEncoding);
-        assertEquals(HTTPSamplerBase.POST, s.getMethod());
+        assertEquals(HTTPConstants.POST, s.getMethod());
         assertEquals(contentEncoding, s.getContentEncoding());
         assertEquals("", s.getQueryString());
         assertTrue(s.getDoMultipartPost());
@@ -560,7 +561,7 @@ public class TestHttpRequestHdr  extends
             throws IOException {
         String postRequest = "POST " + url + " HTTP/1.1" + endOfLine
             + "Content-type: "
-            + HTTPSamplerBase.MULTIPART_FORM_DATA
+            + HTTPConstants.MULTIPART_FORM_DATA
             + "; boundary=" + boundary + endOfLine
             + "Content-length: " + getBodyLength(postBody, contentEncoding) + endOfLine
             + endOfLine

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PostWriterTest.java Sat Jun 23 15:26:36 2012
@@ -36,6 +36,7 @@ import junit.framework.TestCase;
 
 import org.apache.jmeter.config.Arguments;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jorphan.logging.LoggingManager;
 import org.apache.jorphan.util.JOrphanUtils;
@@ -90,7 +91,7 @@ public class PostWriterTest extends Test
      * This method test sending a request which contains both formdata and file content
      */
     public void testSendPostData() throws IOException {
-        sampler.setMethod(HTTPSamplerBase.POST);
+        sampler.setMethod(HTTPConstants.POST);
         setupFilepart(sampler);
         String titleValue = "mytitle";
         String descriptionValue = "mydescription";
@@ -248,7 +249,7 @@ public class PostWriterTest extends Test
      * This method test sending only a file multipart.
      */
     public void testSendFileData_Multipart() throws IOException {
-        sampler.setMethod(HTTPSamplerBase.POST);
+        sampler.setMethod(HTTPConstants.POST);
         String fileField = "upload";
         String mimeType = "text/plain";
         File file = temporaryFile;
@@ -302,7 +303,7 @@ public class PostWriterTest extends Test
      * This method test sending only a formdata, as a multipart/form-data request.
      */
     public void testSendFormData_Multipart() throws IOException {
-        sampler.setMethod(HTTPSamplerBase.POST);
+        sampler.setMethod(HTTPConstants.POST);
         String titleField = "title";
         String titleValue = "mytitle";
         String descriptionField = "description";
@@ -559,7 +560,7 @@ public class PostWriterTest extends Test
      * Test method for 'org.apache.jmeter.protocol.http.sampler.postWriter.setHeaders(URLConnection, HTTPSampler)'
      */
     public void testSetHeaders() throws IOException {
-        sampler.setMethod(HTTPSamplerBase.POST);
+        sampler.setMethod(HTTPConstants.POST);
         setupFilepart(sampler);
         setupFormData(sampler);
         
@@ -878,7 +879,7 @@ public class PostWriterTest extends Test
     }
 
     private void checkContentTypeUrlEncoded(HttpURLConnection conn) {
-        assertEquals(HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED, conn.getRequestProperty("Content-Type"));
+        assertEquals(HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, conn.getRequestProperty("Content-Type"));
     }
 
     private void checkContentLength(HttpURLConnection conn, int length) {

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplers.java Sat Jun 23 15:26:36 2012
@@ -20,6 +20,7 @@ package org.apache.jmeter.protocol.http.
 
 import org.apache.jmeter.config.Argument;
 import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import junit.framework.TestCase;
 
@@ -109,7 +110,7 @@ public class TestHTTPSamplers extends Te
         public void testArgumentWithoutEquals() throws Exception {
             HTTPSamplerBase sampler = new HTTPNullSampler();
             sampler.setProtocol("http");
-            sampler.setMethod(HTTPSamplerBase.GET);
+            sampler.setMethod(HTTPConstants.GET);
             sampler.setPath("/index.html?pear");
             sampler.setDomain("www.apache.org");
             assertEquals("http://www.apache.org/index.html?pear", sampler.getUrl().toString());
@@ -118,7 +119,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.addArgument("param1", "value1");
             config.setPath("/index.html");
             config.setDomain("www.apache.org");
@@ -128,7 +129,7 @@ public class TestHTTPSamplers extends Te
         public void testRedirect() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.setDomain("192.168.0.1");
             HTTPSampleResult res = new HTTPSampleResult();
             res.sampleStart();
@@ -152,7 +153,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl2() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.addArgument("param1", "value1");
             config.setPath("/index.html?p1=p2");
             config.setDomain("192.168.0.1");
@@ -162,7 +163,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl3() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.POST);
+            config.setMethod(HTTPConstants.POST);
             config.addArgument("param1", "value1");
             config.setPath("/index.html?p1=p2");
             config.setDomain("192.168.0.1");
@@ -175,7 +176,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl4() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.addArgument("param1", "value1", "=");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -185,7 +186,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl5() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.addArgument("param1", "", "=");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -195,7 +196,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl6() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.addArgument("param1", "", "");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -208,7 +209,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl7() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.parseArguments("param1=value1");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -218,7 +219,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl8() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.parseArguments("param1=");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -228,7 +229,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl9() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.parseArguments("param1");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");
@@ -238,7 +239,7 @@ public class TestHTTPSamplers extends Te
         public void testMakingUrl10() throws Exception {
             HTTPSamplerBase config = new HTTPNullSampler();
             config.setProtocol("http");
-            config.setMethod(HTTPSamplerBase.GET);
+            config.setMethod(HTTPConstants.GET);
             config.parseArguments("");
             config.setPath("/index.html");
             config.setDomain("192.168.0.1");

Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java?rev=1353144&r1=1353143&r2=1353144&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/TestHTTPSamplersAgainstHttpMirrorServer.java Sat Jun 23 15:26:36 2012
@@ -34,6 +34,7 @@ import org.apache.jmeter.protocol.http.c
 import org.apache.jmeter.protocol.http.control.TestHTTPMirrorThread;
 import org.apache.jmeter.protocol.http.util.EncoderCache;
 import org.apache.jmeter.protocol.http.util.HTTPArgument;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
 import org.apache.jmeter.protocol.http.util.HTTPFileArg;
 import org.apache.jmeter.testelement.TestPlan;
 import org.apache.jmeter.threads.JMeterContextService;
@@ -564,7 +565,7 @@ public class TestHTTPSamplersAgainstHttp
         // Test sending data as UTF-8, with + as part of the value,
         // where the value is set in sampler as not urluencoded, but the 
         // isalwaysencoded flag of the argument is set to false.
-        // This mimics the HTTPSamplerBase.addNonEncodedArgument, which the
+        // This mimics the HTTPConstants.addNonEncodedArgument, which the
         // Proxy server calls in some cases
         sampler = createHttpSampler(samplerType);
         contentEncoding = "UTF-8";
@@ -613,7 +614,7 @@ public class TestHTTPSamplersAgainstHttp
         HTTPSamplerBase sampler = createHttpSampler(samplerType);
         String contentEncoding = "";
         setupUrl(sampler, contentEncoding);
-        sampler.setMethod(HTTPSamplerBase.GET);
+        sampler.setMethod(HTTPConstants.GET);
         HTTPSampleResult res = executeSampler(sampler);
         checkGetRequest(sampler, res);
         
@@ -621,7 +622,7 @@ public class TestHTTPSamplersAgainstHttp
         sampler = createHttpSampler(samplerType);
         contentEncoding = ISO_8859_1;
         setupUrl(sampler, contentEncoding);
-        sampler.setMethod(HTTPSamplerBase.GET);
+        sampler.setMethod(HTTPConstants.GET);
         res = executeSampler(sampler);
         checkGetRequest(sampler, res);
 
@@ -629,7 +630,7 @@ public class TestHTTPSamplersAgainstHttp
         sampler = createHttpSampler(samplerType);
         contentEncoding = "UTF-8";
         setupUrl(sampler, contentEncoding);
-        sampler.setMethod(HTTPSamplerBase.GET);
+        sampler.setMethod(HTTPConstants.GET);
         res = executeSampler(sampler);
         checkGetRequest(sampler, res);
     }
@@ -650,7 +651,7 @@ public class TestHTTPSamplersAgainstHttp
                 // Test sending data with default encoding
                 contentEncoding = "";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                 res = executeSampler(sampler);
                 sampler.setRunningVersion(true);
@@ -665,7 +666,7 @@ public class TestHTTPSamplersAgainstHttp
                 titleValue = "mytitle1\uc385";
                 descriptionValue = "mydescription1\uc385";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                 res = executeSampler(sampler);
                 sampler.setRunningVersion(true);
@@ -680,7 +681,7 @@ public class TestHTTPSamplersAgainstHttp
                 titleValue = "mytitle2\u0153\u20a1\u0115\u00c5";
                 descriptionValue = "mydescription2\u0153\u20a1\u0115\u00c5";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                 res = executeSampler(sampler);
                 sampler.setRunningVersion(true);
@@ -695,7 +696,7 @@ public class TestHTTPSamplersAgainstHttp
                 titleValue = "mytitle3\u0153+\u20a1 \u0115&yes\u00c5";
                 descriptionValue = "mydescription3 \u0153 \u20a1 \u0115 \u00c5";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                 res = executeSampler(sampler);
                 sampler.setRunningVersion(true);
@@ -710,7 +711,7 @@ public class TestHTTPSamplersAgainstHttp
                 titleValue = "mytitle4%2F%3D";
                 descriptionValue = "mydescription4+++%2F%5C";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, true, titleField, titleValue, descriptionField, descriptionValue);
                 res = executeSampler(sampler);
                 sampler.setRunningVersion(true);
@@ -736,7 +737,7 @@ public class TestHTTPSamplersAgainstHttp
                 titleValue = "${title_prefix}mytitle5\u0153\u20a1\u0115\u00c5";
                 descriptionValue = "mydescription5\u0153\u20a1\u0115\u00c5${description_suffix}";
                 setupUrl(sampler, contentEncoding);
-                sampler.setMethod(HTTPSamplerBase.GET);
+                sampler.setMethod(HTTPConstants.GET);
                 setupFormData(sampler, false, titleField, titleValue, descriptionField, descriptionValue);
                 // Replace the variables in the sampler
                 replacer.replaceValues(sampler);
@@ -905,7 +906,7 @@ public class TestHTTPSamplersAgainstHttp
         // Check URL
         assertEquals(sampler.getUrl(), res.getURL());
         // Check request headers
-        checkHeaderTypeLength(res.getRequestHeaders(), HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length);
+        checkHeaderTypeLength(res.getRequestHeaders(), HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length);
          // Check post body from the result query string
         checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), res.getQueryString().getBytes(contentEncoding), contentEncoding, res);
 
@@ -923,7 +924,7 @@ public class TestHTTPSamplersAgainstHttp
             fail("No header and body section found");
         }
         // Check response headers
-        checkHeaderTypeLength(headersSent, HTTPSamplerBase.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length);
+        checkHeaderTypeLength(headersSent, HTTPConstants.APPLICATION_X_WWW_FORM_URLENCODED, expectedPostBody.getBytes(contentEncoding).length);
         // Check post body which was sent to the mirror server, and
         // sent back by the mirror server
         checkArraysHaveSameContent(expectedPostBody.getBytes(contentEncoding), bodySent.getBytes(contentEncoding), contentEncoding, res);
@@ -1081,7 +1082,7 @@ public class TestHTTPSamplersAgainstHttp
         if(headersSent != null) {
             // Get the content length, it tells us how much data to read
             // TODO : Maybe support chunked encoding, then we cannot rely on content length
-            String contentLengthValue = getSentRequestHeaderValue(headersSent, HTTPSamplerBase.HEADER_CONTENT_LENGTH);
+            String contentLengthValue = getSentRequestHeaderValue(headersSent, HTTPConstants.HEADER_CONTENT_LENGTH);
             int contentLength = -1;
             if(contentLengthValue != null) {
                 contentLength = new Integer(contentLengthValue).intValue();
@@ -1103,8 +1104,8 @@ public class TestHTTPSamplersAgainstHttp
     // See: http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6996110
     // TODO any point in checking the other headers?
     private void checkHeaderTypeLength(String requestHeaders, String contentType, int contentLen) {
-        boolean typeOK = isInRequestHeaders(requestHeaders, HTTPSamplerBase.HEADER_CONTENT_TYPE, contentType);
-//        boolean lengOK = isInRequestHeaders(requestHeaders, HTTPSamplerBase.HEADER_CONTENT_LENGTH, Integer.toString(contentLen));
+        boolean typeOK = isInRequestHeaders(requestHeaders, HTTPConstants.HEADER_CONTENT_TYPE, contentType);
+//        boolean lengOK = isInRequestHeaders(requestHeaders, HTTPConstants.HEADER_CONTENT_LENGTH, Integer.toString(contentLen));
         if (!typeOK){
             fail("Expected type:" + contentType + " in:\n"+ requestHeaders);
         }
@@ -1147,7 +1148,7 @@ public class TestHTTPSamplersAgainstHttp
 
     private String getBoundaryStringFromContentType(String requestHeaders) {
         Perl5Matcher localMatcher = JMeterUtils.getMatcher();
-        String regularExpression = "^" + HTTPSamplerBase.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"; 
+        String regularExpression = "^" + HTTPConstants.HEADER_CONTENT_TYPE + ": multipart/form-data; boundary=(.+)$"; 
         Pattern pattern = JMeterUtils.getPattern(regularExpression, Perl5Compiler.READ_ONLY_MASK | Perl5Compiler.CASE_INSENSITIVE_MASK | Perl5Compiler.MULTILINE_MASK);
         if(localMatcher.contains(requestHeaders, pattern)) {
             MatchResult match = localMatcher.getMatch();
@@ -1171,7 +1172,7 @@ public class TestHTTPSamplersAgainstHttp
         String domain = "localhost";
         String path = "/test/somescript.jsp";
         sampler.setProtocol(protocol);
-        sampler.setMethod(HTTPSamplerBase.POST);
+        sampler.setMethod(HTTPConstants.POST);
         sampler.setPath(path);
         sampler.setDomain(domain);
         sampler.setPort(MIRROR_PORT);