Author: pmouawad Date: Sun Dec 4 12:14:42 2011 New Revision: 1210097 URL: http://svn.apache.org/viewvc?rev=1210097&view=rev Log: Add test that uses UrlConnection stub cacheControl (findbugs)
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=1210097&r1=1210096&r2=1210097&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 Sun Dec 4 12:14:42 2011 @@ -202,6 +202,18 @@ public class TestCacheManager extends JM assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); } + + public void testCacheJava() 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)); + ((URLConnectionStub)urlConnection).expires=makeDate(new Date(System.currentTimeMillis())); + ((URLConnectionStub)urlConnection).cacheControl="public, max-age=10"; + this.cacheManager.saveDetails(this.urlConnection, sampleResultOK); + assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); + assertTrue("Should find valid entry",this.cacheManager.inCache(url)); + } public void testExpiresHttpClient() throws Exception{ this.cacheManager.setUseExpires(true); @@ -213,6 +225,7 @@ public class TestCacheManager extends JM assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); assertTrue("Should find valid entry",this.cacheManager.inCache(url)); } + public void testCacheHttpClient() throws Exception{ this.cacheManager.setUseExpires(true);