You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jmeter.apache.org by se...@apache.org on 2014/02/27 00:07:10 UTC

svn commit: r1572330 - /jmeter/trunk/test/src/org/apache/jmeter/protocol/http/control/TestCacheManager.java

Author: sebb
Date: Wed Feb 26 23:07:10 2014
New Revision: 1572330

URL: http://svn.apache.org/r1572330
Log:
Set method in result
Test non-GET method

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=1572330&r1=1572329&r2=1572330&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 Wed Feb 26 23:07:10 2014
@@ -41,7 +41,6 @@ import org.apache.jmeter.junit.JMeterTes
 import org.apache.jmeter.protocol.http.control.CacheManager.CacheEntry;
 import org.apache.jmeter.protocol.http.sampler.HTTPSampleResult;
 import org.apache.jmeter.protocol.http.util.HTTPConstants;
-import org.apache.jmeter.samplers.SampleResult;
 
 public class TestCacheManager extends JMeterTestCase {
     
@@ -259,6 +258,20 @@ public class TestCacheManager extends JM
         assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
     }
     
+    public void testCacheHttpClientHEAD() 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));
+        ((HttpMethodStub)httpMethod).expires=makeDate(new Date(System.currentTimeMillis()));
+        ((HttpMethodStub)httpMethod).cacheControl="public, max-age=5";
+        HTTPSampleResult sampleResultHEAD=getSampleResultWithSpecifiedResponseCode("200");
+        sampleResultHEAD.setHTTPMethod("HEAD");
+        this.cacheManager.saveDetails(httpMethod, sampleResultHEAD);
+        assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST));
+        assertFalse("Should not find valid entry",this.cacheManager.inCache(url));
+    }
+    
     public void testPrivateCacheHttpClient() throws Exception{
         this.cacheManager.setUseExpires(true);
         this.cacheManager.testIterationStart(null);
@@ -437,6 +450,7 @@ public class TestCacheManager extends JM
     private HTTPSampleResult getSampleResultWithSpecifiedResponseCode(String code) {
         HTTPSampleResult sampleResult = new HTTPSampleResult();
         sampleResult.setResponseCode(code);
+        sampleResult.setHTTPMethod("GET");
         return sampleResult;
     }