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/08/30 16:18:25 UTC
svn commit: r1621461 - in
/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler:
HTTPAbstractImpl.java HTTPHC3Impl.java HTTPHC4Impl.java HTTPJavaImpl.java
Author: pmouawad
Date: Sat Aug 30 14:18:24 2014
New Revision: 1621461
URL: http://svn.apache.org/r1621461
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
Factor out common code
Bugzilla Id: 54778
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java?rev=1621461&r1=1621460&r2=1621461&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPAbstractImpl.java Sat Aug 30 14:18:24 2014
@@ -321,4 +321,16 @@ public abstract class HTTPAbstractImpl i
protected void notifySSLContextWasReset() {
// NOOP
}
+
+ /**
+ * Create HTTPSampleResult for a resource in cache
+ * @param res {@link HTTPSampleResult}
+ * @return HTTPSampleResult
+ */
+ protected HTTPSampleResult createSampleResultForResourceInCache(HTTPSampleResult res) {
+ res.sampleEnd();
+ res.setResponseNoContent();
+ res.setSuccessful(true);
+ return res;
+ }
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java?rev=1621461&r1=1621460&r2=1621461&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java Sat Aug 30 14:18:24 2014
@@ -241,10 +241,7 @@ public class HTTPHC3Impl extends HTTPHCA
final CacheManager cacheManager = getCacheManager();
if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
if (cacheManager.inCache(url)) {
- res.sampleEnd();
- res.setResponseNoContent();
- res.setSuccessful(true);
- return res;
+ return createSampleResultForResourceInCache(res);
}
}
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=1621461&r1=1621460&r2=1621461&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 Aug 30 14:18:24 2014
@@ -314,10 +314,7 @@ public class HTTPHC4Impl extends HTTPHCA
final CacheManager cacheManager = getCacheManager();
if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
if (cacheManager.inCache(url)) {
- res.sampleEnd();
- res.setResponseNoContent();
- res.setSuccessful(true);
- return res;
+ return createSampleResultForResourceInCache(res);
}
}
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java?rev=1621461&r1=1621460&r2=1621461&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java Sat Aug 30 14:18:24 2014
@@ -20,14 +20,12 @@ import java.io.BufferedInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
-
import java.net.BindException;
import java.net.HttpURLConnection;
import java.net.InetSocketAddress;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
-
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
@@ -40,16 +38,12 @@ import org.apache.jmeter.protocol.http.c
import org.apache.jmeter.protocol.http.control.Header;
import org.apache.jmeter.protocol.http.control.HeaderManager;
import org.apache.jmeter.protocol.http.util.HTTPConstants;
-
import org.apache.jmeter.samplers.SampleResult;
import org.apache.jmeter.testelement.property.CollectionProperty;
import org.apache.jmeter.testelement.property.PropertyIterator;
-
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jmeter.util.SSLManager;
-
import org.apache.jorphan.logging.LoggingManager;
-
import org.apache.log.Logger;
/**
@@ -470,10 +464,7 @@ public class HTTPJavaImpl extends HTTPAb
final CacheManager cacheManager = getCacheManager();
if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
if (cacheManager.inCache(url)) {
- res.sampleEnd();
- res.setResponseNoContent();
- res.setSuccessful(true);
- return res;
+ return createSampleResultForResourceInCache(res);
}
}