Class CacheManager
- All Implemented Interfaces:
Serializable, Cloneable, ConfigElement, Searchable, TestElement, TestIterationListener, TestStateListener
- See Also:
-
Field Summary
FieldsFields inherited from class ConfigTestElement
PASSWORD, USERNAMEFields inherited from interface TestElement
COMMENTS, ENABLED, GUI_CLASS, NAME, TEST_CLASS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the TestElement of all data.booleanintbooleanbooleanCheck the cache, if the entry has an expires header and the entry has not expired, return truevoidsaveDetails(HttpMethod method, HTTPSampleResult res) Save the Last-Modified, Etag, and Expires headers if the result is cacheable.voidsaveDetails(HttpResponse method, HTTPSampleResult res) Save the Last-Modified, Etag, and Expires headers if the result is cacheable.voidsaveDetails(URLConnection conn, HTTPSampleResult res) Save the Last-Modified, Etag, and Expires headers if the result is cacheable.voidsetClearEachIteration(boolean clear) voidsetHeaders(HttpURLConnection conn, URL url) Check the cache, and if there is a match, set the headers: If-Modified-Since If-None-MatchvoidsetHeaders(URL url, HttpMethod method) Check the cache, and if there is a match, set the headers: If-Modified-Since If-None-Match Commons HttpClient versionvoidsetHeaders(URL url, HttpRequestBase request) Check the cache, and if there is a match, set the headers: If-Modified-Since If-None-Match Apache HttpClient version.voidsetMaxSize(int size) voidsetUseExpires(boolean expires) voidCalled once for all threads after the end of a test.voidCalled once for all threads after the end of a test.voidEach time through a Thread Group's test script, an iteration event is fired for each thread.voidCalled just before the start of the test from the main engine thread.voidtestStarted(String host) Called just before the start of the test from the main engine thread.Methods inherited from class ConfigTestElement
addConfigElement, addTestElement, expectsModificationMethods inherited from class AbstractTestElement
addPropertiesValues, addProperty, addProperty, canRemove, clearTemporary, clearTestElementChildren, clone, emptyTemporary, equals, getComment, getName, getProperty, getPropertyAsBoolean, getPropertyAsBoolean, getPropertyAsDouble, getPropertyAsFloat, getPropertyAsInt, getPropertyAsInt, getPropertyAsLong, getPropertyAsLong, getPropertyAsString, getPropertyAsString, getSearchableTokens, getThreadContext, getThreadName, hashCode, isEnabled, isRunningVersion, isTemporary, logProperties, mergeIn, propertyIterator, recoverRunningVersion, removeProperty, setComment, setEnabled, setName, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setProperty, setRunningVersion, setTemporary, setThreadContext, setThreadName, traverse, traverseCollection, traverseMap, traversePropertyMethods inherited from class Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ConfigElement
clone
-
Field Details
-
CLEAR
- See Also:
-
USE_EXPIRES
- See Also:
-
MAX_SIZE
- See Also:
-
-
Constructor Details
-
CacheManager
public CacheManager()
-
-
Method Details
-
saveDetails
Save the Last-Modified, Etag, and Expires headers if the result is cacheable. Version for Java implementation.- Parameters:
conn- connectionres- result
-
saveDetails
Save the Last-Modified, Etag, and Expires headers if the result is cacheable. Version for Commons HttpClient implementation.- Parameters:
method-to get header information frominvalid reference
HttpMethodres- result to decide if result is cacheable
-
saveDetails
Save the Last-Modified, Etag, and Expires headers if the result is cacheable. Version for Apache HttpClient implementation.- Parameters:
method-to extract header information frominvalid reference
HttpResponseres- result to decide if result is cacheable
-
setHeaders
Check the cache, and if there is a match, set the headers:- If-Modified-Since
- If-None-Match
- Parameters:
url- URL to look up in cachemethod- where to set the headers
-
setHeaders
-
setHeaders
Check the cache, and if there is a match, set the headers:- If-Modified-Since
- If-None-Match
- Parameters:
conn- where to set the headersurl-URLto look up in cache
-
inCache
-
getClearEachIteration
public boolean getClearEachIteration() -
setClearEachIteration
public void setClearEachIteration(boolean clear) -
getUseExpires
public boolean getUseExpires() -
setUseExpires
public void setUseExpires(boolean expires) -
getMaxSize
public int getMaxSize()- Returns:
- int cache max size
-
setMaxSize
public void setMaxSize(int size) - Parameters:
size- int cache max size
-
clear
public void clear()Description copied from class:AbstractTestElementClear the TestElement of all data.- Specified by:
clearin interfaceTestElement- Overrides:
clearin classAbstractTestElement
-
testStarted
public void testStarted()Description copied from interface:TestStateListenerCalled just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testStartedin interfaceTestStateListener- See Also:
-
testEnded
public void testEnded()Description copied from interface:TestStateListenerCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testEndedin interfaceTestStateListener- See Also:
-
testStarted
Description copied from interface:TestStateListenerCalled just before the start of the test from the main engine thread. This is before the test elements are cloned. Note that not all the test variables will have been set up at this point.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testStartedin interfaceTestStateListener- Parameters:
host- name of host- See Also:
-
testEnded
Description copied from interface:TestStateListenerCalled once for all threads after the end of a test. This will use the same element instances as at the start of the test.
N.B. testStarted() and testEnded() are called from different threads.
- Specified by:
testEndedin interfaceTestStateListener- Parameters:
host- name of host- See Also:
-
testIterationStart
Description copied from interface:TestIterationListenerEach time through a Thread Group's test script, an iteration event is fired for each thread. This will be after the test elements have been cloned, so in general the instance will not be the same as the ones the start/end methods call.- Specified by:
testIterationStartin interfaceTestIterationListener- Parameters:
event- the iteration event
-