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 2016/09/03 22:15:04 UTC
svn commit: r1759137 - in /jmeter/trunk:
src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java
xdocs/changes.xml
Author: pmouawad
Date: Sat Sep 3 22:15:03 2016
New Revision: 1759137
URL: http://svn.apache.org/viewvc?rev=1759137&view=rev
Log:
Bug 59962 - Cache Manager does not update expires date when response code is 304.
Bugzilla Id: 59962
Modified:
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java
jmeter/trunk/xdocs/changes.xml
Modified: jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java?rev=1759137&r1=1759136&r2=1759137&view=diff
==============================================================================
--- jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java (original)
+++ jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/control/CacheManager.java Sat Sep 3 22:15:03 2016
@@ -297,13 +297,14 @@ public class CacheManager extends Config
/*
* Is the sample result OK to cache?
- * i.e is it in the 2xx range, and is it a cacheable method?
+ * i.e is it in the 2xx range or equal to 304, and is it a cacheable method?
*/
private boolean isCacheable(HTTPSampleResult res){
final String responseCode = res.getResponseCode();
- return isCacheableMethod(res)
- && "200".compareTo(responseCode) <= 0 // $NON-NLS-1$
- && "299".compareTo(responseCode) >= 0; // $NON-NLS-1$
+ return isCacheableMethod(res)
+ && (("200".compareTo(responseCode) <= 0 // $NON-NLS-1$
+ && "299".compareTo(responseCode) >= 0) // $NON-NLS-1$
+ || "304".equals(responseCode)); // $NON-NLS-1$
}
private boolean isCacheableMethod(HTTPSampleResult res) {
Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java?rev=1759137&r1=1759136&r2=1759137&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManagerBase.java Sat Sep 3 22:15:03 2016
@@ -94,6 +94,22 @@ public abstract class TestCacheManagerBa
}
@Test
+ public void testExpiresBug59962() throws Exception {
+ this.cacheManager.setUseExpires(true);
+ this.cacheManager.testIterationStart(null);
+ assertNull("Should not find entry", getThreadCacheEntry(LOCAL_HOST));
+ assertFalse("Should not find valid entry", this.cacheManager.inCache(url));
+ long start = System.currentTimeMillis();
+ setExpires(makeDate(new Date(start + 2000)));
+ cacheResultWithGivenCode("304");
+ assertNotNull("Should find entry", getThreadCacheEntry(LOCAL_HOST));
+ assertTrue("Should find valid entry", this.cacheManager.inCache(url));
+ sleepTill(start + 2010);
+ assertNotNull("Should find entry", getThreadCacheEntry(LOCAL_HOST));
+ assertFalse("Should not find valid entry", this.cacheManager.inCache(url));
+ }
+
+ @Test
public void testExpires() throws Exception {
this.cacheManager.setUseExpires(true);
this.cacheManager.testIterationStart(null);
@@ -354,4 +370,6 @@ public abstract class TestCacheManagerBa
private CacheManager.CacheEntry getThreadCacheEntry(String url) throws Exception {
return getThreadCache().get(url);
}
+
+
}
Modified: jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jmeter/trunk/xdocs/changes.xml?rev=1759137&r1=1759136&r2=1759137&view=diff
==============================================================================
--- jmeter/trunk/xdocs/changes.xml [utf-8] (original)
+++ jmeter/trunk/xdocs/changes.xml [utf-8] Sat Sep 3 22:15:03 2016
@@ -86,8 +86,7 @@ Summary
<h3>Other samplers</h3>
<ul>
- <li><pr>211</pr>Differentiate the timing for JDBC Sampler. Use latency and connect time.
- Contributed by Thomas Peyrard (thomas.peyrard at murex.com)</li>
+ <li><pr>211</pr>Differentiate the timing for JDBC Sampler. Use latency and connect time. Contributed by Thomas Peyrard (thomas.peyrard at murex.com)</li>
</ul>
<h3>Controllers</h3>
@@ -113,6 +112,7 @@ Summary
<li><bug>59967</bug>CSS/JQuery Extractor : Allow empty default value. Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
<li><bug>59974</bug>Response Assertion : Add button "Add from clipboard". Contributed by Ubik Load Pack (support at ubikloadpack.com)</li>
<li><bug>60050</bug>CSV Data Set : Make it clear in the logs when a thread will exit due to this configuration</li>
+ <li><bug>59962</bug>Cache Manager does not update expires date when response code is 304.</li>
</ul>
<h3>Functions</h3>