You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by fs...@apache.org on 2017/01/19 20:19:57 UTC
svn commit: r1779520 -
/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
Author: fschumacher
Date: Thu Jan 19 20:19:57 2017
New Revision: 1779520
URL: http://svn.apache.org/viewvc?rev=1779520&view=rev
Log:
Split up test case to test only one thing at a time. Correct the second
test case at the same time. PutWriter would use all unnamed arguments for
the body of the request, so set them. This is in preparation for Bug 60575.
Bugzilla Id: 60575
Modified:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java?rev=1779520&r1=1779519&r2=1779520&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/sampler/PutWriterTest.java Thu Jan 19 20:19:57 2017
@@ -21,24 +21,39 @@ package org.apache.jmeter.protocol.http.
import static org.junit.Assert.assertEquals;
import java.net.URLConnection;
+
+import org.apache.jmeter.config.Arguments;
+import org.apache.jmeter.protocol.http.util.HTTPArgument;
import org.apache.jmeter.protocol.http.util.HTTPFileArg;
import org.junit.Test;
import org.apache.jmeter.protocol.http.util.HTTPConstants;
public class PutWriterTest {
-
@Test
- public void testSetHeaders() throws Exception {
+ public void testSetHeadersWithNoParams() throws Exception {
URLConnection uc = new NullURLConnection();
HTTPSampler sampler = new HTTPSampler();
- sampler.setHTTPFiles(new HTTPFileArg[]{new HTTPFileArg("file1", "", "mime1")});
+ sampler.setHTTPFiles(new HTTPFileArg[] { new HTTPFileArg("file1", "",
+ "mime1") });
PutWriter pw = new PutWriter();
pw.setHeaders(uc, sampler);
- assertEquals("mime1", uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
- uc = new NullURLConnection();
- sampler.setHTTPFiles(new HTTPFileArg[]{new HTTPFileArg("file2", "param2", "mime2")});
+ assertEquals("mime1",
+ uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
+ }
+
+ @Test
+ public void testSetHeadersWithParams() throws Exception {
+ URLConnection uc = new NullURLConnection();
+ HTTPSampler sampler = new HTTPSampler();
+ sampler.setHTTPFiles(new HTTPFileArg[] { new HTTPFileArg("file2",
+ "param2", "mime2") });
+ Arguments arguments = new Arguments();
+ arguments.addArgument(new HTTPArgument("", "parameter with no name"));
+ sampler.setArguments(arguments);
+ PutWriter pw = new PutWriter();
pw.setHeaders(uc, sampler);
- assertEquals("mime2", uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
+ assertEquals("mime2",
+ uc.getRequestProperty(HTTPConstants.HEADER_CONTENT_TYPE));
}
}