You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by pm...@apache.org on 2014/10/18 15:09:17 UTC
svn commit: r1632785 - in /jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/sampler/
src/protocol/http/org/apache/jmeter/protocol/http/util/ xdocs/
xdocs/usermanual/
Author: pmouawad
Date: Sat Oct 18 13:09:16 2014
New Revision: 1632785
URL: http://svn.apache.org/r1632785
Log:
Bug 57107 - Patch proposal: Add DAV verbs to HTTP Sampler
Bugzilla Id: 57107
Added:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java (with props)
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
jmeter/trunk/xdocs/changes.xml
jmeter/trunk/xdocs/usermanual/component_reference.xml
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java Sat Oct 18 13:09:16 2014
@@ -108,6 +108,7 @@ import org.apache.jmeter.protocol.http.c
import org.apache.jmeter.protocol.http.control.CacheManager;
import org.apache.jmeter.protocol.http.control.CookieManager;
import org.apache.jmeter.protocol.http.control.HeaderManager;
+import org.apache.jmeter.protocol.http.sampler.HttpWebdav;
import org.apache.jmeter.protocol.http.util.EncoderCache;
import org.apache.jmeter.protocol.http.util.HC4TrustAllSSLSocketFactory;
import org.apache.jmeter.protocol.http.util.HTTPArgument;
@@ -296,6 +297,8 @@ public class HTTPHC4Impl extends HTTPHCA
httpRequest = new HttpGet(uri);
} else if (method.equals(HTTPConstants.PATCH)) {
httpRequest = new HttpPatch(uri);
+ } else if (HttpWebdav.isWebdavMethod(method)) {
+ httpRequest = new HttpWebdav(method, uri);
} else {
throw new IllegalArgumentException("Unexpected method: '"+method+"'");
}
@@ -438,6 +441,7 @@ public class HTTPHC4Impl extends HTTPHCA
String postBody = sendPostData((HttpPost)httpRequest);
result.setQueryString(postBody);
} else if (method.equals(HTTPConstants.PUT) || method.equals(HTTPConstants.PATCH)
+ || HttpWebdav.isWebdavMethod(method)
|| method.equals(HTTPConstants.DELETE)) {
String entityBody = sendEntityData(( HttpEntityEnclosingRequestBase)httpRequest);
result.setQueryString(entityBody);
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java Sat Oct 18 13:09:16 2014
@@ -138,6 +138,7 @@ public class HTTPSampleResult extends Sa
// Include request body if it is a post or put or patch
if (HTTPConstants.POST.equals(method) || HTTPConstants.PUT.equals(method)
|| HTTPConstants.PATCH.equals(method)
+ || HttpWebdav.isWebdavMethod(method)
|| HTTPConstants.DELETE.equals(method)) {
sb.append("\n"+method+" data:\n");
sb.append(queryString);
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java Sat Oct 18 13:09:16 2014
@@ -232,6 +232,13 @@ public abstract class HTTPSamplerBase ex
HTTPConstants.TRACE,
HTTPConstants.DELETE,
HTTPConstants.PATCH,
+ HTTPConstants.PROPFIND,
+ HTTPConstants.PROPPATCH,
+ HTTPConstants.MKCOL,
+ HTTPConstants.COPY,
+ HTTPConstants.MOVE,
+ HTTPConstants.LOCK,
+ HTTPConstants.UNLOCK
};
private static final List<String> METHODLIST = Collections.unmodifiableList(Arrays.asList(METHODS));
Added: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java?rev=1632785&view=auto
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java (added)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java Sat Oct 18 13:09:16 2014
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.jmeter.protocol.http.sampler;
+
+import java.net.URI;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
+import org.apache.jmeter.protocol.http.util.HTTPConstants;
+
+/**
+ * WebDav request
+ * @since 2.12
+ */
+public final class HttpWebdav extends HttpEntityEnclosingRequestBase {
+ private static final Set<String> WEBDAV_METHODS =
+ new HashSet<String>(Arrays.asList(new String[] {
+ HTTPConstants.PROPFIND,
+ HTTPConstants.PROPPATCH,
+ HTTPConstants.MKCOL,
+ HTTPConstants.COPY,
+ HTTPConstants.MOVE,
+ HTTPConstants.LOCK,
+ HTTPConstants.UNLOCK
+ }));
+
+ private String davMethod;
+
+ /**
+ *
+ * @param davMethod
+ * @param uri
+ */
+ public HttpWebdav(final String davMethod, final URI uri) {
+ super();
+ this.davMethod = davMethod;
+ setURI(uri);
+ }
+
+ @Override
+ public String getMethod() {
+ return davMethod;
+ }
+
+ /**
+ * @param method Http Method
+ * @return true if method is a Webdav one
+ */
+ public static boolean isWebdavMethod(String method) {
+ return WEBDAV_METHODS.contains(method);
+ }
+}
\ No newline at end of file
Propchange: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HttpWebdav.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/HTTPConstantsInterface.java Sat Oct 18 13:09:16 2014
@@ -39,6 +39,13 @@ public interface HTTPConstantsInterface
String TRACE = "TRACE"; // $NON-NLS-1$
String DELETE = "DELETE"; // $NON-NLS-1$
String PATCH = "PATCH"; // $NON-NLS-1$
+ String PROPFIND = "PROPFIND"; // $NON-NLS-1$
+ String PROPPATCH = "PROPPATCH"; // $NON-NLS-1$
+ String MKCOL = "MKCOL"; // $NON-NLS-1$
+ String COPY = "COPY"; // $NON-NLS-1$
+ String MOVE = "MOVE"; // $NON-NLS-1$
+ String LOCK = "LOCK"; // $NON-NLS-1$
+ String UNLOCK = "UNLOCK"; // $NON-NLS-1$
String CONNECT = "CONNECT"; // $NON-NLS-1$
String HEADER_AUTHORIZATION = "Authorization"; // $NON-NLS-1$
String HEADER_COOKIE = "Cookie"; // $NON-NLS-1$
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Oct 18 13:09:16 2014
@@ -281,6 +281,7 @@ for details on configuring this componen
<li><bugzilla>56272</bugzilla> - MirrorServer should support query parameters for status and redirects</li>
<li><bugzilla>56772</bugzilla> - Handle IE Conditional comments when parsing embedded resources</li>
<li><bugzilla>57026</bugzilla> - HTTP(S) Test Script Recorder : Better default settings. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
+<li><bugzilla>57107</bugzilla> - Patch proposal: Add DAV verbs to HTTP Sampler. Contributed by Philippe Jung (apache at famille-jung.fr)</li>
</ul>
<h3>Other samplers</h3>
@@ -366,6 +367,7 @@ for details on configuring this componen
<li>Bradford Hovinen (hovinen at gmail.com)</li>
<li><a href="http://blazemeter.com">BlazeMeter Ltd.</a></li>
<li>Graham Russell (graham at ham1.co.uk)</li>
+<li>Philippe Jung (apache at famille-jung.fr)</li>
</ul>
<br/>
Modified: jmeter/trunk/xdocs/usermanual/component_reference.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/usermanual/component_reference.xml?rev=1632785&r1=1632784&r2=1632785&view=diff
==============================================================================
--- jmeter/trunk/xdocs/usermanual/component_reference.xml (original)
+++ jmeter/trunk/xdocs/usermanual/component_reference.xml Sat Oct 18 13:09:16 2014
@@ -152,6 +152,7 @@ Latency is set to the time it takes to l
See Java bugs 6226610 and 6208335.
</li>
<li>It does not support virtual hosts.</li>
+ <li>It does not support the following methods: COPY, LOCK, MKCOL, MOVE, PATCH, PROPFIND, PROPPATCH, UNLOCK.</li>
</ul>
<p>Note: the FILE protocol is intended for testing purposes only.
It is handled by the same code regardless of which HTTP Sampler is used.</p>
@@ -222,7 +223,9 @@ https.default.protocol=SSLv3
If not specified (and not defined by HTTP Request Defaults), the default depends on the value of the JMeter property
<code>jmeter.httpsampler</code>, failing that, the HttpClient4 implementation is used.</property>
<property name="Protocol" required="No">HTTP, HTTPS or FILE. Default: HTTP</property>
- <property name="Method" required="Yes">GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE, PATCH (not supported for JAVA implementation)</property>
+ <property name="Method" required="Yes">GET, POST, HEAD, TRACE, OPTIONS, PUT, DELETE, PATCH (not supported for
+ JAVA implementation). With HttpClient4, the following methods related to WebDav are also allowed: COPY, LOCK, MKCOL, MOVE,
+ PROPFIND, PROPPATCH, UNLOCK.</property>
<property name="Content Encoding" required="No">
Content encoding to be used (for POST, PUT, PATCH and FILE).
This the the character encoding to be used, and is not related to the Content-Encoding HTTP header.