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 2012/07/14 17:55:11 UTC
svn commit: r1361556 -
/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
Author: pmouawad
Date: Sat Jul 14 15:55:11 2012
New Revision: 1361556
URL: http://svn.apache.org/viewvc?rev=1361556&view=rev
Log:
Bug 53522 - Cache Manager should not store at all response with header "no-cache" and store other types of Cache-Control having max-age value
Fixed test case
Bugzilla Id: 53522
Modified:
jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
Modified: jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java
URL: http://svn.apache.org/viewvc/jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java?rev=1361556&r1=1361555&r2=1361556&view=diff
==============================================================================
--- jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java (original)
+++ jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java Sat Jul 14 15:55:11 2012
@@ -71,6 +71,8 @@ public class TestCacheManager extends JM
return expires;
} else if (HTTPConstants.CACHE_CONTROL.equals(name)){
return cacheControl;
+ } else if (HTTPConstants.DATE.equals(name)){
+ return currentTimeInGMT;
}
return super.getHeaderField(name);
}
@@ -85,9 +87,11 @@ public class TestCacheManager extends JM
private Header etagHeader;
private String expires;
private String cacheControl;
+ private Header dateHeader;
HttpMethodStub() {
this.lastModifiedHeader = new Header(HTTPConstants.LAST_MODIFIED, currentTimeInGMT);
+ this.dateHeader = new Header(HTTPConstants.DATE, currentTimeInGMT);
this.etagHeader = new Header(HTTPConstants.ETAG, EXPECTED_ETAG);
}
@@ -101,6 +105,8 @@ public class TestCacheManager extends JM
return expires == null ? null : new Header(HTTPConstants.EXPIRES, expires);
} else if (HTTPConstants.CACHE_CONTROL.equals(headerName)) {
return cacheControl == null ? null : new Header(HTTPConstants.CACHE_CONTROL, cacheControl);
+ } if (HTTPConstants.DATE.equals(headerName)) {
+ return this.dateHeader;
}
return null;
}
@@ -273,9 +279,14 @@ public class TestCacheManager extends JM
assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST));
assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
((HttpMethodStub)httpMethod).cacheControl="private";
+ ((HttpMethodStub)httpMethod).lastModifiedHeader=new Header(HTTPConstants.LAST_MODIFIED,
+ makeDate(new Date(System.currentTimeMillis()-(10*5*1000))));
this.cacheManager.saveDetails(httpMethod, sampleResultOK);
assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST));
assertTrue("Should find valid entry",this.cacheManager.inCache(url));
+ Thread.sleep(5001);
+ assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST));
+ assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
}
public void testPrivateCacheExpireNoMaxAgeHttpClient() throws Exception{