Lines 73-78
public class TestCacheManager extends JMeterTestCase {
Link Here
|
73 |
return cacheControl; |
73 |
return cacheControl; |
74 |
} else if (HTTPConstants.DATE.equals(name)){ |
74 |
} else if (HTTPConstants.DATE.equals(name)){ |
75 |
return currentTimeInGMT; |
75 |
return currentTimeInGMT; |
|
|
76 |
} else if (HTTPConstants.VARY.equals(name)) { |
77 |
return vary; |
76 |
} |
78 |
} |
77 |
return super.getHeaderField(name); |
79 |
return super.getHeaderField(name); |
78 |
} |
80 |
} |
Lines 105-112
public class TestCacheManager extends JMeterTestCase {
Link Here
|
105 |
return expires == null ? null : new Header(HTTPConstants.EXPIRES, expires); |
107 |
return expires == null ? null : new Header(HTTPConstants.EXPIRES, expires); |
106 |
} else if (HTTPConstants.CACHE_CONTROL.equals(headerName)) { |
108 |
} else if (HTTPConstants.CACHE_CONTROL.equals(headerName)) { |
107 |
return cacheControl == null ? null : new Header(HTTPConstants.CACHE_CONTROL, cacheControl); |
109 |
return cacheControl == null ? null : new Header(HTTPConstants.CACHE_CONTROL, cacheControl); |
108 |
} if (HTTPConstants.DATE.equals(headerName)) { |
110 |
} else if (HTTPConstants.DATE.equals(headerName)) { |
109 |
return this.dateHeader; |
111 |
return this.dateHeader; |
|
|
112 |
} else if (HTTPConstants.VARY.equals(headerName)) { |
113 |
return vary == null ? null : new Header(HTTPConstants.VARY, vary); |
110 |
} |
114 |
} |
111 |
return null; |
115 |
return null; |
112 |
} |
116 |
} |
Lines 144-149
public class TestCacheManager extends JMeterTestCase {
Link Here
|
144 |
private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); |
148 |
private static final TimeZone GMT = TimeZone.getTimeZone("GMT"); |
145 |
private CacheManager cacheManager; |
149 |
private CacheManager cacheManager; |
146 |
private String currentTimeInGMT; |
150 |
private String currentTimeInGMT; |
|
|
151 |
private String vary = null; |
147 |
private URL url; |
152 |
private URL url; |
148 |
private URI uri; |
153 |
private URI uri; |
149 |
private URLConnection urlConnection; |
154 |
private URLConnection urlConnection; |
Lines 228-233
public class TestCacheManager extends JMeterTestCase {
Link Here
|
228 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
233 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
229 |
} |
234 |
} |
230 |
|
235 |
|
|
|
236 |
public void testCacheVaryJava() throws Exception{ |
237 |
this.cacheManager.setUseExpires(true); |
238 |
this.cacheManager.testIterationStart(null); |
239 |
assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); |
240 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
241 |
((URLConnectionStub)urlConnection).expires=makeDate(new Date(System.currentTimeMillis())); |
242 |
((URLConnectionStub)urlConnection).cacheControl="public, max-age=5"; |
243 |
this.vary="Accept-Encoding"; |
244 |
this.cacheManager.saveDetails(this.urlConnection, sampleResultOK); |
245 |
this.vary=null; |
246 |
assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); |
247 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
248 |
} |
249 |
|
231 |
public void testExpiresHttpClient() throws Exception{ |
250 |
public void testExpiresHttpClient() throws Exception{ |
232 |
this.cacheManager.setUseExpires(true); |
251 |
this.cacheManager.setUseExpires(true); |
233 |
this.cacheManager.testIterationStart(null); |
252 |
this.cacheManager.testIterationStart(null); |
Lines 257-263
public class TestCacheManager extends JMeterTestCase {
Link Here
|
257 |
assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); |
276 |
assertNotNull("Should find entry",getThreadCacheEntry(LOCAL_HOST)); |
258 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
277 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
259 |
} |
278 |
} |
260 |
|
279 |
|
|
|
280 |
public void testCacheVaryHttpClient() throws Exception{ |
281 |
this.cacheManager.setUseExpires(true); |
282 |
this.cacheManager.testIterationStart(null); |
283 |
assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); |
284 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
285 |
((HttpMethodStub)httpMethod).expires=makeDate(new Date(System.currentTimeMillis())); |
286 |
((HttpMethodStub)httpMethod).cacheControl="public, max-age=5"; |
287 |
this.vary = "Something"; |
288 |
this.cacheManager.saveDetails(httpMethod, sampleResultOK); |
289 |
assertNull("Should not find entry",getThreadCacheEntry(LOCAL_HOST)); |
290 |
assertFalse("Should not find valid entry",this.cacheManager.inCache(url)); |
291 |
this.vary = null; |
292 |
} |
293 |
|
261 |
public void testCacheHttpClientHEAD() throws Exception{ |
294 |
public void testCacheHttpClientHEAD() throws Exception{ |
262 |
this.cacheManager.setUseExpires(true); |
295 |
this.cacheManager.setUseExpires(true); |
263 |
this.cacheManager.testIterationStart(null); |
296 |
this.cacheManager.testIterationStart(null); |