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 21:12:43 UTC

svn commit: r1621523 - in /jmeter/trunk: src/protocol/http/org/apache/jmeter/protocol/http/sampler/ xdocs/

Author: pmouawad
Date: Sat Aug 30 19:12:43 2014
New Revision: 1621523

URL: http://svn.apache.org/r1621523
Log:
Bug 54778 - HTTP Sampler should not return 204 when resource is found in Cache
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
    jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

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=1621523&r1=1621522&r2=1621523&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 19:12:43 2014
@@ -323,14 +323,18 @@ public abstract class HTTPAbstractImpl i
     }
     
     /**
-     * Create HTTPSampleResult for a resource in cache
+     * Update 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;
+    protected HTTPSampleResult updateSampleResultForResourceInCache(HTTPSampleResult res) {
+        // TODO Should we add an option to keep compatibility 
+//        res.sampleEnd();
+//        res.setResponseNoContent();
+//        res.setSuccessful(true);
+//        return res;
+        // We don't want to issue a SampleResult
+        // see https://issues.apache.org/bugzilla/show_bug.cgi?id=54778
+        return null;
     }
 }

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=1621523&r1=1621522&r2=1621523&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 19:12:43 2014
@@ -241,7 +241,7 @@ public class HTTPHC3Impl extends HTTPHCA
             final CacheManager cacheManager = getCacheManager();
             if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
                if (cacheManager.inCache(url)) {
-                   return createSampleResultForResourceInCache(res);
+                   return updateSampleResultForResourceInCache(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=1621523&r1=1621522&r2=1621523&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 19:12:43 2014
@@ -314,7 +314,7 @@ public class HTTPHC4Impl extends HTTPHCA
         final CacheManager cacheManager = getCacheManager();
         if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
            if (cacheManager.inCache(url)) {
-               return createSampleResultForResourceInCache(res);
+               return updateSampleResultForResourceInCache(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=1621523&r1=1621522&r2=1621523&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 19:12:43 2014
@@ -464,7 +464,7 @@ public class HTTPJavaImpl extends HTTPAb
         final CacheManager cacheManager = getCacheManager();
         if (cacheManager != null && HTTPConstants.GET.equalsIgnoreCase(method)) {
            if (cacheManager.inCache(url)) {
-               return createSampleResultForResourceInCache(res);
+               return updateSampleResultForResourceInCache(res);
            }
         }
 

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=1621523&r1=1621522&r2=1621523&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 Aug 30 19:12:43 2014
@@ -1253,7 +1253,7 @@ public abstract class HTTPSamplerBase ex
                             // default: serial download embedded resources
                             HTTPSampleResult binRes = sample(url, HTTPConstants.GET, false, frameDepth + 1);
                             res.addSubResult(binRes);
-                            setParentSampleSuccess(res, res.isSuccessful() && binRes.isSuccessful());
+                            setParentSampleSuccess(res, res.isSuccessful() && (binRes != null ? binRes.isSuccessful() : true));
                         }
 
                     }
@@ -1317,7 +1317,7 @@ public abstract class HTTPSamplerBase ex
                                 }
                             }
                             res.addSubResult(binRes.getResult());
-                            setParentSampleSuccess(res, res.isSuccessful() && binRes.getResult().isSuccessful());
+                            setParentSampleSuccess(res, res.isSuccessful() && (binRes.getResult() != null ? binRes.getResult().isSuccessful():true));
                         } catch (TimeoutException e) {
                             errorResult(e, res);
                         }

Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1621523&r1=1621522&r2=1621523&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml (original)
+++ jmeter/trunk/xdocs/changes.xml Sat Aug 30 19:12:43 2014
@@ -125,6 +125,8 @@ jmeter.gui.action.LookAndFeelCommand: Us
 
 <ul>
 <li>Since JMeter 2.12, Mail Reader Sampler will show 1 for number of samples instead of number of messages retrieved, see <bugzilla>56539</bugzilla></li>
+<li>Since JMeter 2.12, when using Cache Manager, if resource is found in cache no SampleResult will be created, in previous version a SampleResult with empty content and 204 return code was returned, see <bugzilla>54778</bugzilla>.
+</li>
 </ul>
 
 <!-- =================== Bug fixes =================== -->
@@ -140,6 +142,7 @@ jmeter.gui.action.LookAndFeelCommand: Us
 <li><bugzilla>56231</bugzilla> - Move redirect location processing from HC3/HC4 samplers to HTTPSamplerBase#followRedirects()</li>
 <li><bugzilla>56207</bugzilla> - URLs get encoded on redirects in HC3.1 &amp; HC4 samplers</li>
 <li><bugzilla>56303</bugzilla> - The width of target controller's combo list should be set to the current panel size, not on label size of the controllers</li>
+<li><bugzilla>54778</bugzilla> - HTTP Sampler should not return 204 when resource is found in Cache</li>
 </ul>
 
 <h3>Other Samplers</h3>